You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A issue discovered while running HIP programs on OpenCL-BE->rusticl
(with #830). Linking of __chip_atomic_add_f* symbols failed because
the caller's and callee's function signature differed by their pointer
parameters (pointee type didn't match).
The mismatch was caused by LLVM-SPIRV-Translator's feature that
attempts to recover original pointee types in LLVM bitcodes that use
opaque pointers. But the way it attempts to infer the types may end up
with SPIR-V functions with different pointee type across SPIR-V
modules.
The issue is worked around by passing pointers as integers for
functions whose definitions are linked in at runtime.
Copy file name to clipboardExpand all lines: bitcode/README-devicelib.md
+20-1Lines changed: 20 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,4 +35,23 @@ Note: Some amdgcn intrinsics still don't have generic equivalents so for example
35
35
* If there are missing headers, add them to the end of the list with a comment that they're undocumented. The missing documentationt should be reported to AMD or NVIDIA.
36
36
* Avoid using macros, escpecially in the headers.
37
37
*`devicelib.cl` does use some macros mainly to avoid code duplication when declaring function overloads. If you do use macros, make sure to leave a comment with the full function name that the macro expands to.
38
-
* All device-side functions should be declared with `extern "C"` and follow the following naming convention: `__chip_<function_name_snake_case>_<type>` where type is one of `f32`, `f64`, `i32`, `i64`, `u32`, `u64`. For example, `__chip_sin_f32` is the device-side function that implements the `sin` function for `float` arguments. Note: this convention is not yet fully implemented.
38
+
* All device-side functions should be declared with `extern "C"` and follow the following naming convention: `__chip_<function_name_snake_case>_<type>` where type is one of `f32`, `f64`, `i32`, `i64`, `u32`, `u64`. For example, `__chip_sin_f32` is the device-side function that implements the `sin` function for `float` arguments. Note: this convention is not yet fully implemented.
39
+
40
+
## Obfuscated Pointer Parameters
41
+
42
+
A selection of devicelib definitions use `__chip_obfuscated_ptr_t` as
43
+
parameter type insted of regular pointer type. This is for working
44
+
around LLVM-SPIR-VTranslation feature that attempts to recover
45
+
original pointee types in LLVM bitcode input which uses opaque
46
+
pointers (only option with the latest LLVM).
47
+
48
+
An issue with the feature is that the type inference is influenced by
49
+
the surrounding code and this causes situations where same LLVM
50
+
function declarations and definitions may end up to be have parameters
51
+
with different pointee types across SPIR-V modules. Linking such
52
+
modules together will probably trigger undefined behavior. Al least on
53
+
Mesa's rusticl frontend the linking is known to fail.
54
+
55
+
The shortcoming of the type inference is worked around by passing the
56
+
pointer arguments as some non-pointer type (`__chip_obfuscated_ptr_t`)
57
+
and it's used for devicelib definitions which are linked at runtime.
0 commit comments