Repository navigation
feat(rocke): lower u8 and i64 vectors on the HIP route - #14850
cgmillette wants to merge 2 commits into
Conversation
✅ All Checks Passed — Ready for Review
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🎉 All checks passed! This PR is ready for review. |
Each engine's HIP lowering now names every vector from a single table of element type to ext_vector_type prefix. In Python, _type_to_hip reads _VEC_PREFIX instead of repeating its entries in an if-chain. In C++, the three copies of the list (rocke_h_vec_prefix, its membership check and the check in rocke_h_type_to_hip) become one table; rocke_h_vec_prefix returns NULL for an element with no vector type, and its unused full_map flag and "f16x" fallback are gone. The emitted HIP source is unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
buffer_load_vN and buffer_store_vN move u8 and i64 elements, and the LLVM route lowers them, but the HIP route had no vector type for either and refused such a kernel with "no HIP mapping for type vec<u8xN>" or "vec<i64xN>". Both engines now map u8 to u8xN (uint8_t) and i64 to i64xN (int64_t) in their one vector-name table. The shared prologue is unchanged: a kernel that uses one of these vectors gets its declaration after the prologue, as any other width the prologue does not declare, so the HIP source of every existing kernel stays the same. A u8 vector now reaches the vector ops, so vector.smax, vector.smin and vector.sext refuse an unsigned operand on the HIP route as they do on the LLVM route, with the same message. Tests: the buffer access width tests cover u8 and i64 in both engines, check the declarations, compile every width with hipcc for gfx942 and gfx950 and copy them bit-exactly on a GPU through both compile routes. The lshr test covers u8 and i64 lanes, and the signed-op test expects the HIP lowerings to refuse a u8 vector with the LLVM message. The vector-prefix refusal test now uses fp4e2m1, which still has no vector type. Co-Authored-By: Claude <noreply@anthropic.com>
1b65c06 to
2701799
Compare
|
Rebased onto develop now that #14844 (the per-lane-width Re-run on the new head: byte identity green at llvm20, llvm22, llvm23 and llvm24; ctest 34 passed, 1 skipped; the touched tests ( |
Motivation
buffer_load_vNandbuffer_store_vNmove u8 and i64 elements, and the LLVM route lowers them (<N x i8>,<N x i64>). The HIP route had no vector type for either, so a kernel that uses one failed to build withno HIP mapping for type vec<u8xN>/vec<i64xN>. This brings the HIP route to parity, in both engines.Technical Details
Two commits, each in both engines with identical HIP source.
_type_to_hipnow reads_VEC_PREFIXinstead of repeating it in an if-chain. In C++ the three copies of the list (rocke_h_vec_prefix, its membership check and the check inrocke_h_type_to_hip) become one table;rocke_h_vec_prefixreturns NULL for an element with no vector type, and its unusedfull_mapflag and"f16x"fallback are gone. No output change.u8 -> u8xN(uint8_t) andi64 -> i64xN(int64_t).using u8xN = uint8_t __attribute__((ext_vector_type(N)));(or the i64 form) right after the prologue, through the existing per-kernel declaration path that already covers widths the prologue does not declare. So the HIP source of every existing kernel stays the same and no golden is re-recorded.vector.smax,vector.sminandvector.sextrefuse an unsigned operand on the HIP route as they already do on the LLVM route, with the same message.vector.lshron u8 lanes reads them asuint8_tand on i64 lanes asuint64_t.op_vocabulary.mdno longer says u8 / i64 buffer accesses lower through LLVM only.Test Plan
tests/core/test_buffer_access_widths.py: u8 (1, 4, 16) and i64 (1, 2) added to every width check (LLVM IR, both-engine LLVM IR and HIP source, builtin per width); a new test checks the per-kernel declaration follows the prologue once and the prologue has no u8 / i64 vector; the hipcc compile of every width now runs for gfx942 and gfx950; the GPU bit-exact copy through both compile routes covers u8 and i64.tests/core/test_vector_lshr.py(added by the lshr fix): u8 and i64 lanes added to the both-engine HIP source check, the hipcc compile for gfx942 and gfx950, and the GPU comparison of the LLVM route and hipcc on the both-engine HIP source against numpy on lanes with the top bit set and clear.tests/core/test_u8_arith.py: the HIP lowerings refuse a signed vector op on u8 with the LLVM message (they used to stop earlier on the missing type).tests/core/test_amdgpu_lowering_ops.py: the unsupported-element refusal now uses fp4e2m1, since i64 is supported.Test Result
rocke_arch_domain_reproducibility, which needs its measuring compiler). Touched tests (test_vector_lshr.py,test_buffer_access_widths.py,test_u8_arith.py,test_amdgpu_lowering_ops.py,test_mma_io.py): 277 passed with both engines (strict), including the GPU tests on a local gfx90a and the hipcc compiles for gfx942 and gfx950.platform/tests) except 2 tests that fail the same way on develop in that environment (test_arch_domain_lane.py::test_the_cpp_fallback_does_not_warn_twice,test_binding_compiler_selection.py::test_python_bindings_use_the_compiling_library). Each commit was built and tested on its own. Pre-commit clean.ISSUE ID : AICK-2862
🤖 Generated with Claude Code