spirv.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // Copyright (c) 2024 Google LLC
  2. //
  3. // This file is licensed under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. #ifndef _HLSL_VK_SPIRV_H_
  7. #define _HLSL_VK_SPIRV_H_
  8. namespace vk {
  9. enum CooperativeMatrixUse {
  10. CooperativeMatrixUseMatrixAKHR = 0,
  11. CooperativeMatrixUseMatrixBKHR = 1,
  12. CooperativeMatrixUseMatrixAccumulatorKHR = 2,
  13. CooperativeMatrixUseMax = 0x7fffffff,
  14. };
  15. enum CooperativeMatrixLayout {
  16. CooperativeMatrixLayoutRowMajorKHR = 0,
  17. CooperativeMatrixLayoutColumnMajorKHR = 1,
  18. CooperativeMatrixLayoutRowBlockedInterleavedARM = 4202,
  19. CooperativeMatrixLayoutColumnBlockedInterleavedARM = 4203,
  20. CooperativeMatrixLayoutMax = 0x7fffffff,
  21. };
  22. enum CooperativeMatrixOperandsMask {
  23. CooperativeMatrixOperandsMaskNone = 0,
  24. CooperativeMatrixOperandsMatrixASignedComponentsKHRMask = 0x00000001,
  25. CooperativeMatrixOperandsMatrixBSignedComponentsKHRMask = 0x00000002,
  26. CooperativeMatrixOperandsMatrixCSignedComponentsKHRMask = 0x00000004,
  27. CooperativeMatrixOperandsMatrixResultSignedComponentsKHRMask = 0x00000008,
  28. CooperativeMatrixOperandsSaturatingAccumulationKHRMask = 0x00000010,
  29. };
  30. enum MemoryAccessMask {
  31. MemoryAccessMaskNone = 0,
  32. MemoryAccessVolatileMask = 0x00000001,
  33. MemoryAccessAlignedMask = 0x00000002,
  34. MemoryAccessNontemporalMask = 0x00000004,
  35. MemoryAccessMakePointerAvailableMask = 0x00000008,
  36. MemoryAccessMakePointerAvailableKHRMask = 0x00000008,
  37. MemoryAccessMakePointerVisibleMask = 0x00000010,
  38. MemoryAccessMakePointerVisibleKHRMask = 0x00000010,
  39. MemoryAccessNonPrivatePointerMask = 0x00000020,
  40. MemoryAccessNonPrivatePointerKHRMask = 0x00000020,
  41. MemoryAccessAliasScopeINTELMaskMask = 0x00010000,
  42. MemoryAccessNoAliasINTELMaskMask = 0x00020000,
  43. };
  44. enum Scope {
  45. ScopeCrossDevice = 0,
  46. ScopeDevice = 1,
  47. ScopeWorkgroup = 2,
  48. ScopeSubgroup = 3,
  49. ScopeInvocation = 4,
  50. ScopeQueueFamily = 5,
  51. ScopeQueueFamilyKHR = 5,
  52. ScopeShaderCallKHR = 6,
  53. ScopeMax = 0x7fffffff,
  54. };
  55. enum StorageClass {
  56. StorageClassWorkgroup = 4,
  57. };
  58. // An opaque type to represent a Spir-V pointer to the workgroup storage class.
  59. // clang-format off
  60. template <typename PointeeType>
  61. using WorkgroupSpirvPointer = const vk::SpirvOpaqueType<
  62. /* OpTypePointer */ 32,
  63. vk::Literal<vk::integral_constant<uint, StorageClassWorkgroup> >,
  64. PointeeType>;
  65. // clang-format on
  66. // Returns an opaque Spir-V pointer to v. The memory object v's storage class
  67. // modifier must be groupshared. If the incorrect storage class is used, then
  68. // there will be a validation error, and it will not show the correct
  69. template <typename T>
  70. [[vk::ext_instruction(/* OpCopyObject */ 83)]] WorkgroupSpirvPointer<T>
  71. GetGroupSharedAddress([[vk::ext_reference]] T v);
  72. } // namespace vk
  73. #endif // _HLSL_VK_SPIRV_H_