Structs that contain global or local pointers can be passed as kernel
arguments starting OpenCL v2.0 which introduces shared virtual memory.
Trying to revive a patch considered in D49723
Differential D143849
[Clang][OpenCL] Allow pointers in structs as kernel arguments from 2.0 Ayal on Feb 12 2023, 9:40 AM. Authored by
Details Structs that contain global or local pointers can be passed as kernel Trying to revive a patch considered in D49723
Diff Detail Event TimelineComment Actions I feel that originally pointers were disallowed because they create the same issue as size_t and etc as their size is implementation depended but the same logic applies to images and other types that are even more implementation depended. Overall this bit of the spec is very inconsistent so I don't mind if we change the behavior to be whatever we find more helpful. However I would encourage to submit an issue to OpenCL-Docs to point out this inconsistency.
Comment Actions Yeah, pointer sizes need to match, pointers should be passed to clSetKernelExecInfo, and SVM should be employed, which the spec should clarify. In any case the quoted restriction "s6.9.p" of https://registry.khronos.org/OpenCL/sdk/1.2/docs/man/xhtml/restrictions.html justifying the SemA enforcement is clearly absent in https://registry.khronos.org/OpenCL/sdk/2.0/docs/man/xhtml/restrictions.html.
Comment Actions Use -verify=expected,ocl12 instead of #ifdef'ing the test to check diagnostics emitted for 1.2 but not emitted for 2.0.
Comment Actions It's hard for getOpenCLKernelParameterType() to detect and diagnose invalid pointer cases w/o context (of an enclosing struct or not), but it's easy to detect valid pointer cases for v2.0+ and return ValidKernelParam. Rebased.
|
To be honest I feel like it was a bug fix? Do you happen to have any record of the fix?