[libspirv] Convert __assert_fail.ll and image_helpers.ll to CL files#21547
[libspirv] Convert __assert_fail.ll and image_helpers.ll to CL files#21547wenju-he wants to merge 8 commits intointel:syclfrom
Conversation
LLVM IR (.ll) files doesn't work with cmake add_library change in libclc. __assert_fail.cl: - Implemented __strlen_assert helper using pointer arithmetic - Built error message string using OCKL fprintf functions - Retrieved work-item IDs using __oclc_get_* builtins - Used __builtin_trap() to halt execution after assertion image_helpers.cl: - Converted ~105 image_helpers functions from LLVM intrinsics to inline PTX asm - Inline assembly + union-based type conversion gets fully optimized - Compiler eliminates conversion entirely (identical memory layout) - Direct register-to-register operation, no function calls - Eliminates ~105 function call sites and associated memory operations - PTX output verified against reference PTX generated from image_helpers.ll Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Maetveis
left a comment
There was a problem hiding this comment.
LGTM to me in general, with some questions.
I'm trusting you verified that the implementations still work, I didn't go over the inline PTX line-by-line to check it against the llvm intrinsic calls.
@wenju-he is the PR description AI generated? Have you double-checked it is accurate? The last two bullets are not true AFAICT. |
yes, it is AI generated. |
Only verified on CUDA bindless image. We don't have AMDGPU to verify with. |
Okay, I went ahead and reviewed the AMDGPU change against the llvm-ir file. I have some comments and suggestions, see them above. |
Could you please update it to be accurately reflect the changes done after applying suggestions? |
Co-authored-by: Mészáros Gergely <maetveis@gmail.com> Co-authored-by: Wenju He <wenju.he@intel.com>
Done |
I would remove these too as some of them are inacurrate and the others not relevant IMO.
|
Co-authored-by: Mészáros Gergely <maetveis@gmail.com>
Co-authored-by: Wenju He <wenju.he@intel.com>
done, removed. |
…l_id.h And remove extra declaration from __assert_fail.cl.
|
@wenju-he I've pushed a commit to fix needing to declare |
thanks you for the detailed review |
|
@intel/llvm-gatekeepers please merge, thanks. GEN12 fail is unrelated because this PR only affect AMDGPU and CUDA. |
LLVM IR (.ll) files doesn't work with cmake add_library change in libclc.
image_helpers.cl PTX output verified against reference PTX generated from image_helpers.ll.
Bindless image tests passed (no regressions) on NV 2060.