| 1 | //! Intrinsics for GPU targets. |
| 2 | //! |
| 3 | //! Intrinsics in this module are intended for use on GPU targets. |
| 4 | //! They can be target specific but in general GPU targets are similar. |
| 5 | |
| 6 | #![unstable (feature = "gpu_intrinsics" , issue = "none" )] |
| 7 | |
| 8 | /// Returns a pointer to the HSA kernel dispatch packet. |
| 9 | /// |
| 10 | /// A `gpu-kernel` on amdgpu is always launched through a kernel dispatch packet. |
| 11 | /// The dispatch packet contains the workgroup size, launch size and other data. |
| 12 | /// The content is defined by the [HSA Platform System Architecture Specification], |
| 13 | /// which is implemented e.g. in AMD's [hsa.h]. |
| 14 | /// The intrinsic returns a unit pointer so that rustc does not need to know the packet struct. |
| 15 | /// The pointer is valid for the whole lifetime of the program. |
| 16 | /// |
| 17 | /// [HSA Platform System Architecture Specification]: https://hsafoundation.com/wp-content/uploads/2021/02/HSA-SysArch-1.2.pdf |
| 18 | /// [hsa.h]: https://github.com/ROCm/rocm-systems/blob/rocm-7.1.0/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa.h#L2959 |
| 19 | #[rustc_nounwind ] |
| 20 | #[rustc_intrinsic ] |
| 21 | #[cfg (target_arch = "amdgpu" )] |
| 22 | #[must_use = "returns a pointer that does nothing unless used" ] |
| 23 | pub fn amdgpu_dispatch_ptr() -> *const (); |
| 24 | |