JIT: Checked `emitExtractEvexPrefix` asserts on AVX10v1 FP16 instructions with no SIMD prefix (`vrndscalesh`, `vcmpph`, ...)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
失败的检查是 src/coreclr/jit/emitxarch.cpp 中 emitExtractEvexPrefix 里的 assert,位于注释 '// no simd prefix for EVEX2' 下。该 issue 提议在那里检查 InstructionSet_AVX10v1 而不是 AVX10v2,因为 AVX10v2 蕴含 AVX10v1。通过构建 Checked JIT 并编码 vrndscalesh 来验证,示例为 62 F3 7C 08 0A C6 02。当该 assert 不再对 AVX10v1 FP16 指令触发且编码保持不变时完成。
由索引模型根据 Issue 内容生成。
描述
Description
In Checked JIT builds, emitter::emitExtractEvexPrefix asserts when it encodes an AVX10v1 FP16 instruction whose opcode has no SIMD prefix (EVEX pp=00):
Assertion failed 'm_compiler->compIsaSupportedDebugOnly(InstructionSet_AVX10v2) ||
m_compiler->compIsaSupportedDebugOnly(InstructionSet_AVXVNNIINT) ||
m_compiler->compIsaSupportedDebugOnly(InstructionSet_AVXVNNIINT_V512)'
src/coreclr/jit/emitxarch.cpp, emitExtractEvexPrefix (// no simd prefix for EVEX2 - AVX10.2 and above)
The assert assumes that only AVX10v2 and AVX-VNNI-INT instructions use a 4-byte opcode with an empty prefix slot (PSSE38(0x00, ..)/PSSE3A(0x00, ..)). The AVX10v1 FP16 instructions added in #116230 also use that form:
vcmpph, vfpclassph, vfpclasssh, vgetmantph, vgetmantsh, vreduceph, vreducesh, vrndscaleph, vrndscalesh (all PSSE3A(0x00, ..), Encoding_EVEX only).
So whenever AVX10v1 is enabled and AVX10v2 is not, a Checked JIT asserts while emitting these instructions. EnableAVX10v2 defaults to 0, so this happens by default. Release builds skip the assert, and the encoding is correct: pp=00 is right for these NP opcodes. For example, vrndscalesh xmm0, xmm0, xmm6, 2 encodes as 62 F3 7C 08 0A C6 02.
Repro
SuperPMI replay with the Checked alt-JIT and RunAltJitCode=0. In that mode the alt-JIT enables all ISAs that have an Enable* default of 1, including AVX10v1. APX does not need to be enabled.
superpmi.exe -c 284033 -jitoption force AltJit=* -jitoption force AltJitNgen=* -jitoption force RunAltJitCode=0 ^
artifacts\bin\coreclr\windows.x64.Checked\clrjit_win_x64_x64.dll ^
libraries_tests_no_tiered_compilation.run.windows.x64.Release.mch
Collections for JIT-EE GUID c77c1a0f-c8c6-4a68-90db-4d8c1253c5ea (Windows x64 and Linux x64):
| Collection | Method context | Method |
|---|---|---|
libraries_tests_no_tiered_compilation |
284033 | System.Tests.HalfTests:RoundingFunctions (Half rounding uses vrndscalesh) |
libraries_tests_no_tiered_compilation |
220702 | System.Numerics.Tensors.Tests.GenericFloatingPointNumberTensorPrimitivesTests1+<>c__D...` |
libraries_tests |
506942 | (same assert) |
With the native JIT, using the recorded ISA set (F16C only), these methods compile cleanly through vcvtph2ps/vcvtps2ph. Every APX superpmi-replay configuration hits these, because they all use RunAltJitCode=0. I expect a native Checked JIT on AVX10v1 hardware to hit them too, but I have not verified that on hardware.
Suggested fix
AVX10v2 requires AVX10v1 (corinfoinstructionset.h drops AVX10v2 when AVX10v1 is absent), so the assert can check AVX10v1 instead:
assert(m_compiler->compIsaSupportedDebugOnly(InstructionSet_AVX10v1) ||
m_compiler->compIsaSupportedDebugOnly(InstructionSet_AVXVNNIINT) ||
m_compiler->compIsaSupportedDebugOnly(InstructionSet_AVXVNNIINT_V512));
Related
- Past this assert, the same instructions were overestimated by one byte: the empty prefix slot was not subtracted in
emitGetAdjustedSize. This affects the VNNI-INTvpdp*uu*family as well. #137880 fixes that, because it makes estimate/encoding size mismatches assert. - Separate issue: the
JitEmitUnitTestsSections=avx10v2emitter unit tests hitassert(IsSimdVexOrEvexEncodableInstruction(ins) || IsApxExtendedEvexInstruction(ins))inemitDispIns(IF_RWR_RWR_RRD) onvpdpwsud. It reproduces on the current branch without the #137880 changes.
[!NOTE]
This issue was drafted with GitHub Copilot.
- 主要语言
- C#
- 星标
- 18.5k
- 派生
- 5.8k
- 平均合并
- 2 天 18 小时
- 30 天内合并 PR
- 588
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
dotnet/runtime 的其他 Issue
-
area-System.Collections untriaged
难度 2/5 1-3 小时 新手友好度 82/100
dotnet/runtime#138090 · 1 条评论 ·
维护者通常 1 天内回复
-
area-System.Text.Json untriaged
难度 2/5 1-3 小时 新手友好度 72/100
dotnet/runtime#138089 · 1 条评论 ·
维护者通常 1 天内回复
-
area-Setup untriaged
难度 2/5 1-3 小时 新手友好度 76/100
dotnet/runtime#137376 · 1 条评论 ·
维护者通常 1 天内回复
-
area-System.Memory untriaged
难度 2/5 1-3 小时 新手友好度 75/100
dotnet/runtime#137334 · 4 条评论 ·
维护者通常 1 天内回复
-
DbTransaction.SupportsSavepoints docs say Release/ReleaseAsync are expected to throw, but they are no-ops by design可能已有人在做 @alaricd 于 18 天前认领。 未关闭area-System.Transactions untriaged
难度 2/5 1-3 小时 新手友好度 72/100
dotnet/runtime#137040 · 1 条评论 ·
维护者通常 1 天内回复
相似的 Issue
-
needs-area-label
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
area:identity type:bug
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
bug 🐞
难度 2/5 1-3 小时 新手友好度 72/100
valkey-io/valkey-glide#7849 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
bitfoundation/bitplatform#15455 ·
维护者通常 1 天内回复
-
area-Asset area-GameStudio area-Samples bug
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复