From 5304402f05369d7205b1f028e3d6ba574979a035 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Thu, 21 Nov 2024 13:03:53 -0700 Subject: [PATCH 01/45] [SM6.9] Allow native vectors longer than 4 Remove errors in Sema diagnostics for vectors longer than 4 in 6.9. Test for failures using long vectors in unspported contexts and for correct codegen in supported contexts. Verify errors persist in pre-6.9 shader models The type buffer cache expects a max vector size of 4. By just skipping the cache for longer vectors, we don't overrun and store float7 vectors in the double3 slot or retrieve the double3 in place of float7. Testing is for acceptance, mangling and basic copying that takes place at the high level to ensure they are being accepted and recognized correctly. The intent is not to tully test the passing of data as that requires enabling vector operations to do properly. This test is used to verify that these same constructs are disallowed in 6.8 and earlier. A separate test verifies that disallowed contexts produce the appropriate errors Fixes #7117 --- tools/clang/lib/Sema/SemaHLSL.cpp | 12 +- .../CodeGenDXIL/hlsl/types/longvec_decls.hlsl | 263 ++++++++++++++++++ .../hlsl/types/invalid_longvecs_sm68.hlsl | 34 +++ 3 files changed, 306 insertions(+), 3 deletions(-) create mode 100644 tools/clang/test/CodeGenDXIL/hlsl/types/longvec_decls.hlsl create mode 100644 tools/clang/test/SemaHLSL/hlsl/types/invalid_longvecs_sm68.hlsl diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index ba0801dd52..69cd2a88e3 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -3928,7 +3928,9 @@ class HLSLExternalSource : public ExternalSemaSource { } QualType LookupVectorType(HLSLScalarType scalarType, unsigned int colCount) { - QualType qt = m_vectorTypes[scalarType][colCount - 1]; + QualType qt; + if (colCount < 4) + qt = m_vectorTypes[scalarType][colCount - 1]; if (qt.isNull()) { if (m_scalarTypes[scalarType].isNull()) { LookupScalarTypeDef(scalarType); @@ -3936,7 +3938,8 @@ class HLSLExternalSource : public ExternalSemaSource { qt = GetOrCreateVectorSpecialization(*m_context, m_sema, m_vectorTemplateDecl, m_scalarTypes[scalarType], colCount); - m_vectorTypes[scalarType][colCount - 1] = qt; + if (colCount < 4) + m_vectorTypes[scalarType][colCount - 1] = qt; } return qt; } @@ -5055,7 +5058,10 @@ class HLSLExternalSource : public ExternalSemaSource { bool CheckRangedTemplateArgument(SourceLocation diagLoc, llvm::APSInt &sintValue) { - if (!sintValue.isStrictlyPositive() || sintValue.getLimitedValue() > 4) { + const auto *SM = + hlsl::ShaderModel::GetByName(m_sema->getLangOpts().HLSLProfile.c_str()); + if (!sintValue.isStrictlyPositive() || + (sintValue.getLimitedValue() > 4 && !SM->IsSM69Plus())) { m_sema->Diag(diagLoc, diag::err_hlsl_invalid_range_1_4); return true; } diff --git a/tools/clang/test/CodeGenDXIL/hlsl/types/longvec_decls.hlsl b/tools/clang/test/CodeGenDXIL/hlsl/types/longvec_decls.hlsl new file mode 100644 index 0000000000..d6672e7678 --- /dev/null +++ b/tools/clang/test/CodeGenDXIL/hlsl/types/longvec_decls.hlsl @@ -0,0 +1,263 @@ +// RUN: %dxc -fcgl -T lib_6_9 -DTYPE=float -DNUM=7 %s | FileCheck %s +// RUN: %dxc -fcgl -T lib_6_9 -DTYPE=bool -DNUM=7 %s | FileCheck %s +// RUN: %dxc -fcgl -T lib_6_9 -DTYPE=uint64_t -DNUM=7 %s | FileCheck %s +// RUN: %dxc -fcgl -T lib_6_9 -DTYPE=double -DNUM=7 %s | FileCheck %s +// RUN: %dxc -fcgl -T lib_6_9 -DTYPE=float16_t -DNUM=7 -enable-16bit-types %s | FileCheck %s +// RUN: %dxc -fcgl -T lib_6_9 -DTYPE=int16_t -DNUM=7 -enable-16bit-types %s | FileCheck %s + +// A test to verify that declarations of longvecs are permitted in all the accepted places. +// Only tests for acceptance, most codegen is ignored for now. + +// CHECK: %struct.LongVec = type { <4 x float>, <7 x [[STY:[a-z0-9]*]]> } +struct LongVec { + float4 f; + vector vec; +}; + + +// Just some dummies to capture the types and mangles. +// CHECK: @"\01?dummy@@3[[MNG:F|M|N|_N|_K|\$f16@]]A" = external addrspace(3) global [[STY]] +groupshared TYPE dummy; + +// CHECK-DAG: @"\01?gs_vec@@3V?$vector@[[MNG]]$06@@A" = external addrspace(3) global <7 x [[STY]]> +// CHECK-DAG: @"\01?gs_vec_arr@@3PAV?$vector@[[MNG]]$06@@A" = external addrspace(3) global [10 x <7 x [[STY]]>] +// CHECK-DAG: @"\01?gs_vec_rec@@3ULongVec@@A" = external addrspace(3) global %struct.LongVec +groupshared vector gs_vec; +groupshared vector gs_vec_arr[10]; +groupshared LongVec gs_vec_rec; + +// CHECK-DAG: @static_vec = internal global <7 x [[STY]]> +// CHECK-DAG: @static_vec_arr = internal global [10 x <7 x [[STY]]>] zeroinitializer +// CHECK-DAG: @static_vec_rec = internal global %struct.LongVec +static vector static_vec; +static vector static_vec_arr[10]; +static LongVec static_vec_rec; + +// CHECK: define [[RTY:[a-z0-9]*]] @"\01?getVal@@YA[[MNG]][[MNG]]@Z"([[RTY]] {{.*}}%t) +export TYPE getVal(TYPE t) {TYPE ret = dummy; dummy = t; return ret;} + +// CHECK: define <7 x [[RTY]]> +// CHECK-LABEL: @"\01?lv_param_passthru +// CHECK-SAME: @@YA?AV?$vector@[[MNG]]$06@@V1@@Z"(<7 x [[RTY]]> %vec1) +// CHECK: ret <7 x [[RTY]]> +export vector lv_param_passthru(vector vec1) { + vector ret = vec1; + return ret; +} + +// CHECK-LABEL: define void @"\01?lv_param_in_out +// CHECK-SAME: @@YAXV?$vector@[[MNG]]$06@@AIAV1@@Z"(<7 x [[RTY]]> %vec1, <7 x [[STY]]>* noalias dereferenceable({{[0-9]*}}) %vec2) +// CHECK: store <7 x [[STY]]> {{%.*}}, <7 x [[STY]]>* %vec2, align 4 +// CHECK: ret void +export void lv_param_in_out(in vector vec1, out vector vec2) { + vec2 = vec1; +} + +// CHECK-LABEL: define void @"\01?lv_param_inout +// CHECK-SAME: @@YAXAIAV?$vector@[[MNG]]$06@@0@Z"(<7 x [[STY]]>* noalias dereferenceable({{[0-9]*}}) %vec1, <7 x [[STY]]>* noalias dereferenceable({{[0-9]*}}) %vec2) +// CHECK: load <7 x [[STY]]>, <7 x [[STY]]>* %vec1, align 4 +// CHECK: load <7 x [[STY]]>, <7 x [[STY]]>* %vec2, align 4 +// CHECK: store <7 x [[STY]]> {{%.*}}, <7 x [[STY]]>* %vec1, align 4 +// CHECK: store <7 x [[STY]]> {{%.*}}, <7 x [[STY]]>* %vec2, align 4 +// CHECK: ret void +export void lv_param_inout(inout vector vec1, inout vector vec2) { + vector tmp = vec1; + vec1 = vec2; + vec2 = tmp; +} + +// CHECK-LABEL: define void @"\01?lv_param_in_out_rec@@YAXULongVec@@U1@@Z"(%struct.LongVec* %vec1, %struct.LongVec* noalias %vec2) +// CHECK: memcpy +// CHECK: ret void +export void lv_param_in_out_rec(in LongVec vec1, out LongVec vec2) { + vec2 = vec1; +} + +// CHECK-LABEL: define void @"\01?lv_param_inout_rec@@YAXULongVec@@0@Z"(%struct.LongVec* noalias %vec1, %struct.LongVec* noalias %vec2) +// CHECK: memcpy +// CHECK: ret void +export void lv_param_inout_rec(inout LongVec vec1, inout LongVec vec2) { + LongVec tmp = vec1; + vec1 = vec2; + vec2 = tmp; +} + +// CHECK-LABEL: define void @"\01?lv_global_assign +// CHECK-SAME: @@YAXV?$vector@[[MNG]]$06@@@Z"(<7 x [[RTY]]> %vec) +// CHECK: store <7 x [[STY]]> {{%.*}}, <7 x [[STY]]>* @static_vec +// CHECK: ret void +export void lv_global_assign(vector vec) { + static_vec = vec; +} + +// CHECK: define <7 x [[RTY]]> +// CHECK-LABEL: @"\01?lv_global_ret +// CHECK-SAME: @@YA?AV?$vector@[[MNG]]$06@@XZ"() +// CHECK: load <7 x [[STY]]>, <7 x [[STY]]>* @static_vec +// CHECK: ret <7 x [[RTY]]> +export vector lv_global_ret() { + vector ret = static_vec; + return ret; +} + +// CHECK-LABEL: define void @"\01?lv_gs_assign +// CHECK-SAME: @@YAXV?$vector@[[MNG]]$06@@@Z"(<7 x [[RTY]]> %vec) +// CHECK: store <7 x [[STY]]> {{%.*}}, <7 x [[STY]]> addrspace(3)* @"\01?gs_vec@@3V?$vector@[[MNG]]$06@@A" +// CHECK: ret void +export void lv_gs_assign(vector vec) { + gs_vec = vec; +} + +// CHECK: define <7 x [[RTY]]> +// CHECK-LABEL: @"\01?lv_gs_ret +// CHECK-SAME: @@YA?AV?$vector@[[MNG]]$06@@XZ"() +// CHECK: load <7 x [[STY]]>, <7 x [[STY]]> addrspace(3)* @"\01?gs_vec@@3V?$vector@[[MNG]]$06@@A" +// CHECK: ret <7 x [[RTY]]> +export vector lv_gs_ret() { + vector ret = gs_vec; + return ret; +} + +#define DIMS 10 + +// CHECK-LABEL: define void @"\01?lv_param_arr_passthru +// CHECK-SAME: @@YA$$BY09V?$vector@[[MNG]]$06@@V1@@Z"([10 x <7 x [[STY]]>]* noalias sret %agg.result, <7 x [[RTY]]> %vec) +// Arrays are returned in the params +// CHECK: ret void +export vector lv_param_arr_passthru(vector vec)[10] { + vector ret[10]; + for (int i = 0; i < DIMS; i++) + ret[i] = vec; + return ret; +} + +// CHECK-LABEL: define void @"\01?lv_global_arr_assign +// CHECK-SAME: @@YAXY09V?$vector@[[MNG]]$06@@@Z"([10 x <7 x [[STY]]>]* %vec) +// CHECK: ret void +export void lv_global_arr_assign(vector vec[10]) { + for (int i = 0; i < DIMS; i++) + static_vec_arr[i] = vec[i]; +} + +// CHECK-LABEL: define void @"\01?lv_global_arr_ret +// CHECK-SAME: @@YA$$BY09V?$vector@[[MNG]]$06@@XZ"([10 x <7 x [[STY]]>]* noalias sret %agg.result) +// Arrays are returned in the params +// CHECK: ret void +export vector lv_global_arr_ret()[10] { + vector ret[10]; + for (int i = 0; i < DIMS; i++) + ret[i] = static_vec_arr[i]; + return ret; +} + +// CHECK-LABEL: define void @"\01?lv_gs_arr_assign +// CHECK-SAME: @@YAXY09V?$vector@[[MNG]]$06@@@Z"([10 x <7 x [[STY]]>]* %vec) +// ret void +export void lv_gs_arr_assign(vector vec[10]) { + for (int i = 0; i < DIMS; i++) + gs_vec_arr[i] = vec[i]; +} + +// CHECK-LABEL: define void @"\01?lv_gs_arr_ret +// CHECK-SAME: @@YA$$BY09V?$vector@[[MNG]]$06@@XZ"([10 x <7 x [[STY]]>]* noalias sret %agg.result) +export vector lv_gs_arr_ret()[10] { + vector ret[10]; + for (int i = 0; i < DIMS; i++) + ret[i] = gs_vec_arr[i]; + return ret; +} + +// CHECK-LABEL: define void @"\01?lv_param_rec_passthru@@YA?AULongVec@@U1@@Z"(%struct.LongVec* noalias sret %agg.result, %struct.LongVec* %vec) +// CHECK: memcpy +// Aggregates are returned in the params +// CHECK: ret void +export LongVec lv_param_rec_passthru(LongVec vec) { + LongVec ret = vec; + return ret; +} + +// CHECK-LABEL: define void @"\01?lv_global_rec_assign@@YAXULongVec@@@Z"(%struct.LongVec* %vec) +// CHECK: memcpy +// CHECK: ret void +export void lv_global_rec_assign(LongVec vec) { + static_vec_rec = vec; +} + +// CHECK-LABEL: define void @"\01?lv_global_rec_ret@@YA?AULongVec@@XZ"(%struct.LongVec* noalias sret %agg.result) +// CHECK: memcpy +// Aggregates are returned in the params +// CHECK: ret void +export LongVec lv_global_rec_ret() { + LongVec ret = static_vec_rec; + return ret; +} + +// CHECK-LABEL: define void @"\01?lv_gs_rec_assign@@YAXULongVec@@@Z"(%struct.LongVec* %vec) +// CHECK: memcpy +// CHECK: ret void +export void lv_gs_rec_assign(LongVec vec) { + gs_vec_rec = vec; +} + +// CHECK-LABEL: define void @"\01?lv_gs_rec_ret@@YA?AULongVec@@XZ"(%struct.LongVec* noalias sret %agg.result) +// CHECK: memcpy +// Aggregates are returned in the params +// CHECK: ret void +export LongVec lv_gs_rec_ret() { + LongVec ret = gs_vec_rec; + return ret; +} + +// CHECK: define <7 x [[RTY]]> +// CHECK-LABEL: @"\01?lv_splat +// CHECK-SAME: @@YA?AV?$vector@[[MNG]]$06@@[[MNG]]@Z"([[RTY]] {{.*}}%scalar) +// CHECK: ret <7 x [[RTY]]> +export vector lv_splat(TYPE scalar) { + vector ret = scalar; + return ret; +} + +// CHECK: define <6 x [[RTY]]> +// CHECK-LABEL: @"\01?lv_initlist +// CHECK-SAME: @@YA?AV?$vector@[[MNG]]$05@@XZ"() +// CHECK: ret <6 x [[RTY]]> +export vector lv_initlist() { + vector ret = {1, 2, 3, 4, 5, 6}; + return ret; +} + +// CHECK: define <6 x [[RTY]]> +// CHECK-LABEL: @"\01?lv_initlist_vec +// CHECK-SAME: @@YA?AV?$vector@[[MNG]]$05@@V?$vector@[[MNG]]$02@@@Z"(<3 x [[RTY]]> %vec) +// CHECK: ret <6 x [[RTY]]> +export vector lv_initlist_vec(vector vec) { + vector ret = {vec, 4.0, 5.0, 6.0}; + return ret; +} + +// CHECK: define <6 x [[RTY]]> +// CHECK-LABEL: @"\01?lv_vec_vec +// CHECK-SAME: @@YA?AV?$vector@[[MNG]]$05@@V?$vector@[[MNG]]$02@@0@Z"(<3 x [[RTY]]> %vec1, <3 x [[RTY]]> %vec2) +// CHECK: ret <6 x [[RTY]]> +export vector lv_vec_vec(vector vec1, vector vec2) { + vector ret = {vec1, vec2}; + return ret; +} + +// CHECK: define <7 x [[RTY]]> +// CHECK-LABEL: @"\01?lv_array_cast +// CHECK-SAME: @@YA?AV?$vector@[[MNG]]$06@@Y06[[MNG]]@Z"([7 x [[STY]]]* %arr) +// CHECK: ret <7 x [[RTY]]> +export vector lv_array_cast(TYPE arr[NUM]) { + vector ret = (vector)arr; + return ret; +} + +// CHECK: define <6 x [[RTY]]> +// CHECK-LABEL: @"\01?lv_ctor +// CHECK-SAME: @@YA?AV?$vector@[[MNG]]$05@@[[MNG]]@Z"([[RTY]] {{.*}}%s) +// CHECK: ret <6 x [[RTY]]> +export vector lv_ctor(TYPE s) { + vector ret = vector(1.0, 2.0, 3.0, 4.0, 5.0, s); + return ret; +} diff --git a/tools/clang/test/SemaHLSL/hlsl/types/invalid_longvecs_sm68.hlsl b/tools/clang/test/SemaHLSL/hlsl/types/invalid_longvecs_sm68.hlsl new file mode 100644 index 0000000000..42eb6b077c --- /dev/null +++ b/tools/clang/test/SemaHLSL/hlsl/types/invalid_longvecs_sm68.hlsl @@ -0,0 +1,34 @@ +// RUN: %dxc -T ps_6_8 -verify %s + +#define TYPE float +#define NUM 5 + +struct LongVec { + float4 f; + vector vec; // expected-error{{invalid value, valid range is between 1 and 4 inclusive}} +}; +groupshared vector gs_vec; // expected-error{{invalid value, valid range is between 1 and 4 inclusive}} +groupshared vector gs_vec_arr[10]; // expected-error{{invalid value, valid range is between 1 and 4 inclusive}} + +static vector static_vec; // expected-error{{invalid value, valid range is between 1 and 4 inclusive}} +static vector static_vec_arr[10]; // expected-error{{invalid value, valid range is between 1 and 4 inclusive}} + +export vector lv_param_passthru( // expected-error{{invalid value, valid range is between 1 and 4 inclusive}} + vector vec1) { // expected-error{{invalid value, valid range is between 1 and 4 inclusive}} + vector ret = vec1; // expected-error{{invalid value, valid range is between 1 and 4 inclusive}} + vector arr[10]; // expected-error{{invalid value, valid range is between 1 and 4 inclusive}} + arr[1]= vec1; + return ret; +} + +export void lv_param_in_out(in vector vec1, // expected-error{{invalid value, valid range is between 1 and 4 inclusive}} + out vector vec2) { // expected-error{{invalid value, valid range is between 1 and 4 inclusive}} + vec2 = vec1; +} + +export void lv_param_inout(inout vector vec1, // expected-error{{invalid value, valid range is between 1 and 4 inclusive}} + inout vector vec2) { // expected-error{{invalid value, valid range is between 1 and 4 inclusive}} + vector tmp = vec1; // expected-error{{invalid value, valid range is between 1 and 4 inclusive}} + vec1 = vec2; + vec2 = tmp; +} From e010223f74f9c2d96d51349849cd5f5e99542e99 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Thu, 5 Dec 2024 10:55:40 -1000 Subject: [PATCH 02/45] Produce errors for long vectors in invalid contexts Disallow long vectors, and arrays or structs containing long vectors in cbuffers, entry functions, node records, tessellation patchs, or special intrinsic parameters with user-defined struct parameters. --- tools/clang/include/clang/AST/HlslTypes.h | 6 +- tools/clang/include/clang/Basic/Attr.td | 12 ++ .../clang/Basic/DiagnosticSemaKinds.td | 4 +- tools/clang/include/clang/Sema/SemaHLSL.h | 2 + tools/clang/lib/AST/ASTContextHLSL.cpp | 19 ++- tools/clang/lib/Sema/SemaDXR.cpp | 6 + tools/clang/lib/Sema/SemaHLSL.cpp | 127 +++++++++++++++-- tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp | 10 ++ .../hlsl/types/invalid_longvec_decls.hlsl | 132 ++++++++++++++++++ .../hlsl/types/invalid_longvec_decls_68.hlsl | 108 ++++++++++++++ .../hlsl/types/invalid_longvec_decls_hs.hlsl | 24 ++++ 11 files changed, 426 insertions(+), 24 deletions(-) create mode 100644 tools/clang/test/SemaHLSL/hlsl/types/invalid_longvec_decls.hlsl create mode 100644 tools/clang/test/SemaHLSL/hlsl/types/invalid_longvec_decls_68.hlsl create mode 100644 tools/clang/test/SemaHLSL/hlsl/types/invalid_longvec_decls_hs.hlsl diff --git a/tools/clang/include/clang/AST/HlslTypes.h b/tools/clang/include/clang/AST/HlslTypes.h index d11fd598e6..2aa9afa5f9 100644 --- a/tools/clang/include/clang/AST/HlslTypes.h +++ b/tools/clang/include/clang/AST/HlslTypes.h @@ -370,12 +370,14 @@ void AddStdIsEqualImplementation(clang::ASTContext &context, clang::Sema &sema); clang::CXXRecordDecl *DeclareTemplateTypeWithHandle( clang::ASTContext &context, llvm::StringRef name, uint8_t templateArgCount = 1, - clang::TypeSourceInfo *defaultTypeArgValue = nullptr); + clang::TypeSourceInfo *defaultTypeArgValue = nullptr, + clang::InheritableAttr *Attr = nullptr); clang::CXXRecordDecl *DeclareTemplateTypeWithHandleInDeclContext( clang::ASTContext &context, clang::DeclContext *declContext, llvm::StringRef name, uint8_t templateArgCount, - clang::TypeSourceInfo *defaultTypeArgValue); + clang::TypeSourceInfo *defaultTypeArgValue, + clang::InheritableAttr *Attr = nullptr); clang::CXXRecordDecl *DeclareUIntTemplatedTypeWithHandle( clang::ASTContext &context, llvm::StringRef typeName, diff --git a/tools/clang/include/clang/Basic/Attr.td b/tools/clang/include/clang/Basic/Attr.td index 6d2295dc4a..5ca9d4b333 100644 --- a/tools/clang/include/clang/Basic/Attr.td +++ b/tools/clang/include/clang/Basic/Attr.td @@ -992,6 +992,18 @@ def HLSLNodeTrackRWInputSharing : InheritableAttr { let Documentation = [Undocumented]; } +def HLSLCBuffer : InheritableAttr { + let Spellings = []; // No spellings! + let Subjects = SubjectList<[CXXRecord]>; + let Documentation = [Undocumented]; +} + +def HLSLTessPatch : InheritableAttr { + let Spellings = []; // No spellings! + let Subjects = SubjectList<[CXXRecord]>; + let Documentation = [Undocumented]; +} + def HLSLNodeObject : InheritableAttr { let Spellings = []; // No spellings! let Subjects = SubjectList<[CXXRecord]>; diff --git a/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td b/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td index f79b8f6045..c85f6a6863 100644 --- a/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -7691,8 +7691,6 @@ def err_hlsl_control_flow_cond_not_scalar : Error< "%0 statement conditional expressions must evaluate to a scalar">; def err_hlsl_unsupportedvectortype : Error< "%0 is declared with type %1, but only primitive scalar values are supported">; -def err_hlsl_unsupportedvectorsize : Error< - "%0 is declared with size %1, but only values 1 through 4 are supported">; def err_hlsl_unsupportedmatrixsize : Error< "%0 is declared with size %1x%2, but only values 1 through 4 are supported">; def err_hlsl_norm_float_only : Error< @@ -7843,6 +7841,8 @@ def err_hlsl_load_from_mesh_out_arrays: Error< "output arrays of a mesh shader can not be read from">; def err_hlsl_out_indices_array_incorrect_access: Error< "a vector in out indices array must be accessed as a whole">; +def err_hlsl_unsupported_long_vector: Error< + "Vectors of over 4 elements in %0 are not supported">; def err_hlsl_logical_binop_scalar : Error< "operands for short-circuiting logical binary operator must be scalar, for non-scalar types use '%select{and|or}0'">; def err_hlsl_ternary_scalar : Error< diff --git a/tools/clang/include/clang/Sema/SemaHLSL.h b/tools/clang/include/clang/Sema/SemaHLSL.h index 40b030b430..c52131b8a5 100644 --- a/tools/clang/include/clang/Sema/SemaHLSL.h +++ b/tools/clang/include/clang/Sema/SemaHLSL.h @@ -128,6 +128,8 @@ unsigned CaculateInitListArraySizeForHLSL(clang::Sema *sema, const clang::InitListExpr *InitList, const clang::QualType EltTy); +bool HasLongVecs(const clang::QualType &qt); + bool IsConversionToLessOrEqualElements(clang::Sema *self, const clang::ExprResult &sourceExpr, const clang::QualType &targetType, diff --git a/tools/clang/lib/AST/ASTContextHLSL.cpp b/tools/clang/lib/AST/ASTContextHLSL.cpp index 3c058950e0..978c97aeb5 100644 --- a/tools/clang/lib/AST/ASTContextHLSL.cpp +++ b/tools/clang/lib/AST/ASTContextHLSL.cpp @@ -903,18 +903,19 @@ void hlsl::AddStdIsEqualImplementation(clang::ASTContext &context, /// Number of template arguments (one or /// two). If assigned, the default /// argument for the element template. -CXXRecordDecl * -hlsl::DeclareTemplateTypeWithHandle(ASTContext &context, StringRef name, - uint8_t templateArgCount, - TypeSourceInfo *defaultTypeArgValue) { +CXXRecordDecl *hlsl::DeclareTemplateTypeWithHandle( + ASTContext &context, StringRef name, uint8_t templateArgCount, + TypeSourceInfo *defaultTypeArgValue, InheritableAttr *Attr) { return DeclareTemplateTypeWithHandleInDeclContext( context, context.getTranslationUnitDecl(), name, templateArgCount, - defaultTypeArgValue); + defaultTypeArgValue, Attr); } CXXRecordDecl *hlsl::DeclareTemplateTypeWithHandleInDeclContext( ASTContext &context, DeclContext *declContext, StringRef name, - uint8_t templateArgCount, TypeSourceInfo *defaultTypeArgValue) { + uint8_t templateArgCount, TypeSourceInfo *defaultTypeArgValue, + InheritableAttr *Attr) { + DXASSERT(templateArgCount != 0, "otherwise caller should be creating a class or struct"); DXASSERT(templateArgCount <= 2, "otherwise the function needs to be updated " @@ -968,6 +969,9 @@ CXXRecordDecl *hlsl::DeclareTemplateTypeWithHandleInDeclContext( typeDeclBuilder.addField("h", elementType); + if (Attr) + typeDeclBuilder.getRecordDecl()->addAttr(Attr); + return typeDeclBuilder.getRecordDecl(); } @@ -1131,6 +1135,9 @@ hlsl::DeclareConstantBufferViewType(clang::ASTContext &context, bool bTBuf) { typeDeclBuilder.addField( "h", context.UnsignedIntTy); // Add an 'h' field to hold the handle. + typeDeclBuilder.getRecordDecl()->addAttr( + HLSLCBufferAttr::CreateImplicit(context)); + typeDeclBuilder.getRecordDecl(); return templateRecordDecl; diff --git a/tools/clang/lib/Sema/SemaDXR.cpp b/tools/clang/lib/Sema/SemaDXR.cpp index 6d838fb203..cb16ced5df 100644 --- a/tools/clang/lib/Sema/SemaDXR.cpp +++ b/tools/clang/lib/Sema/SemaDXR.cpp @@ -810,6 +810,12 @@ void DiagnoseTraceCall(Sema &S, const VarDecl *Payload, return; } + if (hlsl::HasLongVecs(Payload->getType())) { + S.Diag(Payload->getLocation(), diag::err_hlsl_unsupported_long_vector) + << "payload parameters"; + return; + } + CollectNonAccessableFields(PayloadType, CallerStage, {}, {}, NonWriteableFields, NonReadableFields); diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index 69cd2a88e3..c5a30e00fa 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -3733,10 +3733,14 @@ class HLSLExternalSource : public ExternalSemaSource { DXASSERT(templateArgCount == 1 || templateArgCount == 2, "otherwise a new case has been added"); + InheritableAttr *Attr = nullptr; + if (kind == AR_OBJECT_INPUTPATCH || kind == AR_OBJECT_OUTPUTPATCH) + Attr = HLSLTessPatchAttr::CreateImplicit(*m_context); + TypeSourceInfo *typeDefault = TemplateHasDefaultType(kind) ? float4TypeSourceInfo : nullptr; recordDecl = DeclareTemplateTypeWithHandle( - *m_context, typeName, templateArgCount, typeDefault); + *m_context, typeName, templateArgCount, typeDefault, Attr); } m_objectTypeDecls[i] = recordDecl; m_objectTypeDeclsMap[i] = std::make_pair(recordDecl, i); @@ -4896,10 +4900,6 @@ class HLSLExternalSource : public ExternalSemaSource { AR_BASIC_UNKNOWN; } - /// Checks whether the specified value is a valid vector - /// size. - bool IsValidVectorSize(size_t length) { return 1 <= length && length <= 4; } - /// Checks whether the specified value is a valid matrix row or /// column size. bool IsValidMatrixColOrRowSize(size_t length) { @@ -4935,11 +4935,6 @@ class HLSLExternalSource : public ExternalSemaSource { false); } else if (objectKind == AR_TOBJ_VECTOR) { bool valid = true; - if (!IsValidVectorSize(GetHLSLVecSize(type))) { - valid = false; - m_sema->Diag(argLoc, diag::err_hlsl_unsupportedvectorsize) - << type << GetHLSLVecSize(type); - } if (!IsScalarType(GetMatrixOrVectorElementType(type))) { valid = false; m_sema->Diag(argLoc, diag::err_hlsl_unsupportedvectortype) @@ -5085,11 +5080,12 @@ class HLSLExternalSource : public ExternalSemaSource { return false; } // Allow object type for Constant/TextureBuffer. - if (templateName == "ConstantBuffer" || templateName == "TextureBuffer") { + if (Template->getTemplatedDecl()->hasAttr()) { if (TemplateArgList.size() == 1) { const TemplateArgumentLoc &argLoc = TemplateArgList[0]; const TemplateArgument &arg = argLoc.getArgument(); - DXASSERT(arg.getKind() == TemplateArgument::ArgKind::Type, ""); + DXASSERT(arg.getKind() == TemplateArgument::ArgKind::Type, + "cbuffer with non-type template arg"); QualType argType = arg.getAsType(); SourceLocation argSrcLoc = argLoc.getLocation(); if (IsScalarType(argType) || IsVectorType(m_sema, argType) || @@ -5099,6 +5095,12 @@ class HLSLExternalSource : public ExternalSemaSource { << argType; return true; } + if (HasLongVecs(argType)) { + m_sema->Diag(argSrcLoc, diag::err_hlsl_unsupported_long_vector) + << "cbuffers"; + return true; + } + if (auto *TST = dyn_cast(argType)) { // This is a bit of a special case we need to handle. Because the // buffer types don't use their template parameter in a way that would @@ -5182,8 +5184,20 @@ class HLSLExternalSource : public ExternalSemaSource { return true; } return false; + } else if (Template->getTemplatedDecl()->hasAttr()) { + DXASSERT(TemplateArgList.size() == 1, + "Tessellation patch has more than one template arg"); + const TemplateArgumentLoc &argLoc = TemplateArgList[0]; + const TemplateArgument &arg = argLoc.getArgument(); + DXASSERT(arg.getKind() == TemplateArgument::ArgKind::Type, ""); + QualType argType = arg.getAsType(); + if (HasLongVecs(argType)) { + m_sema->Diag(argLoc.getLocation(), + diag::err_hlsl_unsupported_long_vector) + << "tessellation patches"; + return true; + } } - bool isMatrix = Template->getCanonicalDecl() == m_matrixTemplateDecl->getCanonicalDecl(); bool isVector = Template->getCanonicalDecl() == @@ -11423,10 +11437,17 @@ bool hlsl::DiagnoseNodeStructArgument(Sema *self, TemplateArgumentLoc ArgLoc, HLSLExternalSource *source = HLSLExternalSource::FromSema(self); ArTypeObjectKind shapeKind = source->GetTypeObjectKind(ArgTy); switch (shapeKind) { + case AR_TOBJ_VECTOR: + if (GetHLSLVecSize(ArgTy) > 4) { + self->Diag(ArgLoc.getLocation(), diag::err_hlsl_unsupported_long_vector) + << "node records"; + Empty = false; + return false; + } + LLVM_FALLTHROUGH; case AR_TOBJ_ARRAY: case AR_TOBJ_BASIC: case AR_TOBJ_MATRIX: - case AR_TOBJ_VECTOR: Empty = false; return false; case AR_TOBJ_OBJECT: @@ -11888,6 +11909,33 @@ bool hlsl::ShouldSkipNRVO(clang::Sema &sema, clang::QualType returnType, return false; } +bool hlsl::HasLongVecs(const QualType &qt) { + if (qt.isNull()) { + return false; + } + + if (IsHLSLVecType(qt)) { + if (GetHLSLVecSize(qt) > 4) + return true; + } else if (qt->isArrayType()) { + const ArrayType *arrayType = qt->getAsArrayTypeUnsafe(); + return HasLongVecs(arrayType->getElementType()); + } else if (qt->isStructureOrClassType()) { + const RecordType *recordType = qt->getAs(); + const RecordDecl *recordDecl = recordType->getDecl(); + if (recordDecl->isInvalidDecl()) + return false; + RecordDecl::field_iterator begin = recordDecl->field_begin(); + RecordDecl::field_iterator end = recordDecl->field_end(); + for (; begin != end; begin++) { + const FieldDecl *fieldDecl = *begin; + if (HasLongVecs(fieldDecl->getType())) + return true; + } + } + return false; +} + bool hlsl::IsConversionToLessOrEqualElements( clang::Sema *self, const clang::ExprResult &sourceExpr, const clang::QualType &targetType, bool explicitConversion) { @@ -14211,6 +14259,7 @@ bool Sema::DiagnoseHLSLDecl(Declarator &D, DeclContext *DC, Expr *BitWidth, *pDispatchGrid = nullptr, *pMaxDispatchGrid = nullptr; bool usageIn = false; bool usageOut = false; + bool isGroupShared = false; for (clang::AttributeList *pAttr = D.getDeclSpec().getAttributes().getList(); pAttr != NULL; pAttr = pAttr->getNext()) { @@ -14234,6 +14283,7 @@ bool Sema::DiagnoseHLSLDecl(Declarator &D, DeclContext *DC, Expr *BitWidth, } break; case AttributeList::AT_HLSLGroupShared: + isGroupShared = true; if (!isGlobal) { Diag(pAttr->getLoc(), diag::err_hlsl_varmodifierna) << pAttr->getName() << declarationType << pAttr->getRange(); @@ -14514,6 +14564,12 @@ bool Sema::DiagnoseHLSLDecl(Declarator &D, DeclContext *DC, Expr *BitWidth, result = false; } + // Disallow long vecs from cbuffers. + if (isGlobal && !isStatic && !isGroupShared && HasLongVecs(qt)) { + Diag(D.getLocStart(), diag::err_hlsl_unsupported_long_vector) << "cbuffers"; + result = false; + } + // SPIRV change starts #ifdef ENABLE_SPIRV_CODEGEN // Validate that Vulkan specific feature is only used when targeting SPIR-V @@ -15402,6 +15458,16 @@ static bool isRelatedDeclMarkedNointerpolation(Expr *E) { return false; } +// Verify that user-defined intrinsic struct args contain no long vectors +static bool CheckUDTIntrinsicArg(Sema *S, Expr *Arg) { + if (HasLongVecs(Arg->getType())) { + S->Diag(Arg->getExprLoc(), diag::err_hlsl_unsupported_long_vector) + << "user-defined struct parameter"; + return true; + } + return false; +} + static bool CheckIntrinsicGetAttributeAtVertex(Sema *S, FunctionDecl *FDecl, CallExpr *TheCall) { assert(TheCall->getNumArgs() > 0); @@ -15419,6 +15485,12 @@ static bool CheckIntrinsicGetAttributeAtVertex(Sema *S, FunctionDecl *FDecl, bool Sema::CheckHLSLIntrinsicCall(FunctionDecl *FDecl, CallExpr *TheCall) { auto attr = FDecl->getAttr(); + if (!attr) + return false; + + if (!IsBuiltinTable(attr->getGroup())) + return false; + switch (hlsl::IntrinsicOp(attr->getOpcode())) { case hlsl::IntrinsicOp::IOP_GetAttributeAtVertex: // See #hlsl-specs/issues/181. Feature is broken. For SPIR-V we want @@ -15430,6 +15502,22 @@ bool Sema::CheckHLSLIntrinsicCall(FunctionDecl *FDecl, CallExpr *TheCall) { // existing ones. See the ExtensionTest.EvalAttributeCollision test. assert(FDecl->getName() == "GetAttributeAtVertex"); return CheckIntrinsicGetAttributeAtVertex(this, FDecl, TheCall); + case hlsl::IntrinsicOp::IOP_DispatchMesh: + assert(TheCall->getNumArgs() > 3); + assert(FDecl->getName() == "DispatchMesh"); + return CheckUDTIntrinsicArg(this, TheCall->getArg(3)->IgnoreCasts()); + case hlsl::IntrinsicOp::IOP_CallShader: + assert(TheCall->getNumArgs() > 1); + assert(FDecl->getName() == "CallShader"); + return CheckUDTIntrinsicArg(this, TheCall->getArg(1)->IgnoreCasts()); + case hlsl::IntrinsicOp::IOP_TraceRay: + assert(TheCall->getNumArgs() > 7); + assert(FDecl->getName() == "TraceRay"); + return CheckUDTIntrinsicArg(this, TheCall->getArg(7)->IgnoreCasts()); + case hlsl::IntrinsicOp::IOP_ReportHit: + assert(TheCall->getNumArgs() > 2); + assert(FDecl->getName() == "ReportHit"); + return CheckUDTIntrinsicArg(this, TheCall->getArg(2)->IgnoreCasts()); default: break; } @@ -16110,6 +16198,17 @@ void DiagnoseEntry(Sema &S, FunctionDecl *FD) { return; } + // Check general parameter characteristics + // Would be nice to check for resources here as they crash the compiler now. + for (const auto *param : FD->params()) + if (HasLongVecs(param->getType())) + S.Diag(param->getLocation(), diag::err_hlsl_unsupported_long_vector) + << "entry function parameters"; + + if (HasLongVecs(FD->getReturnType())) + S.Diag(FD->getLocation(), diag::err_hlsl_unsupported_long_vector) + << "entry function return type"; + DXIL::ShaderKind Stage = ShaderModel::KindFromFullName(shaderAttr->getStage()); llvm::StringRef StageName = shaderAttr->getStage(); diff --git a/tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp b/tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp index cf5d741541..ee5ea567ce 100644 --- a/tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp +++ b/tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp @@ -520,6 +520,16 @@ void hlsl::DiagnoseTranslationUnit(clang::Sema *self) { << hullPatchCount.value(); } } + for (const auto *param : pPatchFnDecl->params()) + if (HasLongVecs(param->getType())) + self->Diag(param->getLocation(), + diag::err_hlsl_unsupported_long_vector) + << "patch constant function parameters"; + + if (HasLongVecs(pPatchFnDecl->getReturnType())) + self->Diag(pPatchFnDecl->getLocation(), + diag::err_hlsl_unsupported_long_vector) + << "patch constant function return type"; } DXIL::ShaderKind EntrySK = shaderModel->GetKind(); diff --git a/tools/clang/test/SemaHLSL/hlsl/types/invalid_longvec_decls.hlsl b/tools/clang/test/SemaHLSL/hlsl/types/invalid_longvec_decls.hlsl new file mode 100644 index 0000000000..ae52983772 --- /dev/null +++ b/tools/clang/test/SemaHLSL/hlsl/types/invalid_longvec_decls.hlsl @@ -0,0 +1,132 @@ +// RUN: %dxc -DTYPE=float -DNUM=7 -T ps_6_9 -verify %s + +struct [raypayload] LongVec { + float4 f : write(closesthit) : read(caller); + vector vec : write(closesthit) : read(caller); +}; + +struct LongVecParm { + float f; + float4 tar2 : SV_Target2; + vector vec; +}; + +vector global_vec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} + +vector global_vec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} + +LongVec global_vec_rec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} + +cbuffer BadBuffy { + vector cb_vec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} + vector cb_vec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} + LongVec cb_vec_rec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} +}; + +tbuffer BadTuffy { + vector tb_vec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} + vector tb_vec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} + LongVec tb_vec_rec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} +}; + +ConstantBuffer< LongVec > const_buf; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} +TextureBuffer< LongVec > tex_buf; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} + +vector main( // expected-error{{Vectors of over 4 elements in entry function return type are not supported}} + vector vec : V, // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} + LongVecParm parm : P) : SV_Target { // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} + parm.f = vec; // expected-warning {{implicit truncation of vector type}} + parm.tar2 = vec; // expected-warning {{implicit truncation of vector type}} + return vec; // expected-warning {{implicit truncation of vector type}} +} + +[shader("domain")] +[domain("tri")] +void ds_main(OutputPatch TrianglePatch) {} // expected-error{{Vectors of over 4 elements in tessellation patches are not supported}} + +void PatchConstantFunction(InputPatch inpatch, // expected-error{{Vectors of over 4 elements in tessellation patches are not supported}} + OutputPatch outpatch) {} // expected-error{{Vectors of over 4 elements in tessellation patches are not supported}} + + +[shader("hull")] +[domain("tri")] +[outputtopology("triangle_cw")] +[outputcontrolpoints(32)] +[patchconstantfunc("PatchConstantFunction")] +void hs_main(InputPatch TrianglePatch) {} // expected-error{{Vectors of over 4 elements in tessellation patches are not supported}} + +RaytracingAccelerationStructure RTAS; + +[shader("raygeneration")] +void raygen() { + LongVec p = (LongVec)0; + RayDesc ray = (RayDesc)0; + TraceRay(RTAS, RAY_FLAG_NONE, 0, 0, 1, 0, ray, p); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} + CallShader(0, p); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} +} + +[shader("closesthit")] +void closesthit(inout LongVec payload, // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} + in LongVec attribs ) { // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} + RayDesc ray; + TraceRay( RTAS, RAY_FLAG_NONE, 0xff, 0, 1, 0, ray, payload ); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} + CallShader(0, payload); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} +} + +[shader("anyhit")] +void AnyHit( inout LongVec payload, // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} + in LongVec attribs ) // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} +{ +} + +[shader("miss")] +void Miss(inout LongVec payload){ // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} + RayDesc ray; + TraceRay( RTAS, RAY_FLAG_NONE, 0xff, 0, 1, 0, ray, payload ); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} + CallShader(0, payload); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} +} + +[shader("intersection")] +void Intersection() { + float hitT = RayTCurrent(); + LongVec attr = (LongVec)0; + bool bReported = ReportHit(hitT, 0, attr); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} +} + +[shader("callable")] +void callable1(inout LongVec p) { // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} + CallShader(0, p); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} +} + +groupshared LongVec as_pld; + +[shader("amplification")] +[numthreads(1,1,1)] +void Amp() { + DispatchMesh(1,1,1,as_pld); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} +} + +struct LongVecRec { + uint3 grid : SV_DispatchGrid; + vector vec; +}; + +[Shader("node")] +[NodeLaunch("broadcasting")] +[NumThreads(8,1,1)] +[NodeMaxDispatchGrid(8,1,1)] +void broadcast(DispatchNodeInputRecord input, // expected-error{{Vectors of over 4 elements in node records are not supported}} + NodeOutput output) // expected-error{{Vectors of over 4 elements in node records are not supported}} +{ + ThreadNodeOutputRecords touts; // expected-error{{Vectors of over 4 elements in node records are not supported}} + GroupNodeOutputRecords gouts; // expected-error{{Vectors of over 4 elements in node records are not supported}} +} + +[Shader("node")] +[NodeLaunch("coalescing")] +[NumThreads(8,1,1)] +void coalesce(GroupNodeInputRecords input) {} // expected-error{{Vectors of over 4 elements in node records are not supported}} + +[Shader("node")] +[NodeLaunch("thread")] +void threader(ThreadNodeInputRecord input) {} // expected-error{{Vectors of over 4 elements in node records are not supported}} diff --git a/tools/clang/test/SemaHLSL/hlsl/types/invalid_longvec_decls_68.hlsl b/tools/clang/test/SemaHLSL/hlsl/types/invalid_longvec_decls_68.hlsl new file mode 100644 index 0000000000..8aac527c1f --- /dev/null +++ b/tools/clang/test/SemaHLSL/hlsl/types/invalid_longvec_decls_68.hlsl @@ -0,0 +1,108 @@ +// RUN: %dxc -DTYPE=float -DNUM=7 -T ps_6_8 -verify %s + +// CHECK: %struct.LongVec = type { <4 x float>, <7 x [[STY:[a-z0-9]*]]> } +struct LongVec { + float4 f; + vector vec; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} +}; + +static vector static_vec; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} +static vector static_vec_arr[10]; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + +groupshared vector gs_vec; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} +groupshared vector gs_vec_arr[10]; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + +export vector lv_param_passthru(vector vec1) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + vector ret = vec1; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + return ret; +} + +export void lv_param_in_out(in vector vec1, out vector vec2) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + vec2 = vec1; +} + +export void lv_param_inout(inout vector vec1, inout vector vec2) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + vector tmp = vec1; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + vec1 = vec2; + vec2 = tmp; +} + +export void lv_global_assign(vector vec) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + static_vec = vec; +} + +export vector lv_global_ret() { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + vector ret = static_vec; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + return ret; +} + +export void lv_gs_assign(vector vec) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + gs_vec = vec; +} + +export vector lv_gs_ret() { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + vector ret = gs_vec; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + return ret; +} + +export vector lv_param_arr_passthru(vector vec)[10] { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + vector ret[10]; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + for (int i = 0; i < 10; i++) + ret[i] = vec; + return ret; +} + +export void lv_global_arr_assign(vector vec[10]) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + for (int i = 0; i < 10; i++) + static_vec_arr[i] = vec[i]; +} + +export vector lv_global_arr_ret()[10] { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + vector ret[10]; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + for (int i = 0; i < 10; i++) + ret[i] = static_vec_arr[i]; + return ret; +} + +export void lv_gs_arr_assign(vector vec[10]) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + for (int i = 0; i < 10; i++) + gs_vec_arr[i] = vec[i]; +} + +export vector lv_gs_arr_ret()[10] { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + vector ret[10]; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + for (int i = 0; i < 10; i++) + ret[i] = gs_vec_arr[i]; + return ret; +} + +export vector lv_splat(TYPE scalar) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + vector ret = scalar; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + return ret; +} + +export vector lv_initlist() { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + vector ret = {1, 2, 3, 4, 5, 6}; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + return ret; +} + +export vector lv_initlist_vec(vector vec) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + vector ret = {vec, 4.0, 5.0, 6.0}; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + return ret; +} + +export vector lv_vec_vec(vector vec1, vector vec2) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + vector ret = {vec1, vec2}; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + return ret; +} + +export vector lv_array_cast(TYPE arr[NUM]) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + vector ret = (vector)arr; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + return ret; +} + +export vector lv_ctor(TYPE s) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + vector ret = vector(1.0, 2.0, 3.0, 4.0, 5.0, s); // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} + return ret; +} + diff --git a/tools/clang/test/SemaHLSL/hlsl/types/invalid_longvec_decls_hs.hlsl b/tools/clang/test/SemaHLSL/hlsl/types/invalid_longvec_decls_hs.hlsl new file mode 100644 index 0000000000..185233ad0f --- /dev/null +++ b/tools/clang/test/SemaHLSL/hlsl/types/invalid_longvec_decls_hs.hlsl @@ -0,0 +1,24 @@ +// RUN: %dxc -DTYPE=float -DNUM=7 -T hs_6_9 -verify %s + +struct HsConstantData { + float Edges[3] : SV_TessFactor; + vector vec; +}; + +struct LongVec { + float4 f; + vector vec; +}; + +HsConstantData PatchConstantFunction( // expected-error{{Vectors of over 4 elements in patch constant function return type are not supported}} + vector vec : V, // expected-error{{Vectors of over 4 elements in patch constant function parameters are not supported}} + LongVec lv : L) { // expected-error{{Vectors of over 4 elements in patch constant function parameters are not supported}} + return (HsConstantData)0; +} + +[domain("tri")] +[outputtopology("triangle_cw")] +[outputcontrolpoints(32)] +[patchconstantfunc("PatchConstantFunction")] +void main() { +} From cd72abec4341d7de07fbd7f7807f145b0960134a Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Tue, 18 Feb 2025 11:17:17 -0700 Subject: [PATCH 03/45] fix assert for tesselation patch template args This got lost somewhere --- tools/clang/lib/Sema/SemaHLSL.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index c5a30e00fa..aea960f2e8 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -5185,8 +5185,8 @@ class HLSLExternalSource : public ExternalSemaSource { } return false; } else if (Template->getTemplatedDecl()->hasAttr()) { - DXASSERT(TemplateArgList.size() == 1, - "Tessellation patch has more than one template arg"); + DXASSERT(TemplateArgList.size() > 0, + "Tessellation patch should have at least one template args"); const TemplateArgumentLoc &argLoc = TemplateArgList[0]; const TemplateArgument &arg = argLoc.getArgument(); DXASSERT(arg.getKind() == TemplateArgument::ArgKind::Type, ""); From 1f12a3f08fd896ee005170c8ff7025f3de204950 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Sun, 2 Mar 2025 22:33:24 -0700 Subject: [PATCH 04/45] Refactor builtin type detection with attributes Expand resource attribute to all resource types by adding reskind and resclass arguments indicating the specific resource type. Change detection in HlslTypes to use these attribute arguments. Similarly add vertex number arguments to output stream attribute and a boolean indicator of input or output for tessellation patches. Add geomstream attr to detect those objects Use attribute to detect tesselation patches Removes template arg counts and startswith stirngs to identify tesslations patches and distinguish them from multisampled textures --- tools/clang/include/clang/AST/HlslTypes.h | 7 +- tools/clang/include/clang/Basic/Attr.td | 6 +- tools/clang/lib/AST/ASTContextHLSL.cpp | 28 ++-- tools/clang/lib/AST/HlslTypes.cpp | 190 +++++----------------- tools/clang/lib/Sema/SemaHLSL.cpp | 68 ++++++-- 5 files changed, 121 insertions(+), 178 deletions(-) diff --git a/tools/clang/include/clang/AST/HlslTypes.h b/tools/clang/include/clang/AST/HlslTypes.h index 2aa9afa5f9..9aeb97d3ee 100644 --- a/tools/clang/include/clang/AST/HlslTypes.h +++ b/tools/clang/include/clang/AST/HlslTypes.h @@ -350,7 +350,8 @@ void AddHLSLNodeOutputRecordTemplate( clang::CXXRecordDecl *DeclareRecordTypeWithHandle(clang::ASTContext &context, llvm::StringRef name, - bool isCompleteType = true); + bool isCompleteType = true, + clang::InheritableAttr *Attr = nullptr); void AddRaytracingConstants(clang::ASTContext &context); void AddSamplerFeedbackConstants(clang::ASTContext &context); @@ -382,11 +383,11 @@ clang::CXXRecordDecl *DeclareTemplateTypeWithHandleInDeclContext( clang::CXXRecordDecl *DeclareUIntTemplatedTypeWithHandle( clang::ASTContext &context, llvm::StringRef typeName, llvm::StringRef templateParamName, - clang::TagTypeKind tagKind = clang::TagTypeKind::TTK_Class); + clang::InheritableAttr *Attr = nullptr); clang::CXXRecordDecl *DeclareUIntTemplatedTypeWithHandleInDeclContext( clang::ASTContext &context, clang::DeclContext *declContext, llvm::StringRef typeName, llvm::StringRef templateParamName, - clang::TagTypeKind tagKind = clang::TagTypeKind::TTK_Class); + clang::InheritableAttr *Attr = nullptr); clang::CXXRecordDecl *DeclareConstantBufferViewType(clang::ASTContext &context, bool bTBuf); clang::CXXRecordDecl *DeclareRayQueryType(clang::ASTContext &context); diff --git a/tools/clang/include/clang/Basic/Attr.td b/tools/clang/include/clang/Basic/Attr.td index 7304bba06e..e344e7b851 100644 --- a/tools/clang/include/clang/Basic/Attr.td +++ b/tools/clang/include/clang/Basic/Attr.td @@ -993,14 +993,16 @@ def HLSLNodeTrackRWInputSharing : InheritableAttr { } -def HLSLCBuffer : InheritableAttr { +def HLSLTessPatch : InheritableAttr { let Spellings = []; // No spellings! + let Args = [BoolArgument<"IsInput">]; let Subjects = SubjectList<[CXXRecord]>; let Documentation = [Undocumented]; } -def HLSLTessPatch : InheritableAttr { +def HLSLStreamOutput : InheritableAttr { let Spellings = []; // No spellings! + let Args = [UnsignedArgument<"Vertices">]; let Subjects = SubjectList<[CXXRecord]>; let Documentation = [Undocumented]; } diff --git a/tools/clang/lib/AST/ASTContextHLSL.cpp b/tools/clang/lib/AST/ASTContextHLSL.cpp index 978c97aeb5..e71f37b663 100644 --- a/tools/clang/lib/AST/ASTContextHLSL.cpp +++ b/tools/clang/lib/AST/ASTContextHLSL.cpp @@ -525,11 +525,15 @@ hlsl::DeclareRecordTypeWithHandleAndNoMemberFunctions(ASTContext &context, /// CXXRecordDecl * hlsl::DeclareRecordTypeWithHandle(ASTContext &context, StringRef name, - bool isCompleteType /*= true */) { + bool isCompleteType /*= true */, + InheritableAttr *Attr) { BuiltinTypeDeclBuilder typeDeclBuilder(context.getTranslationUnitDecl(), name, TagDecl::TagKind::TTK_Struct); typeDeclBuilder.startDefinition(); typeDeclBuilder.addField("h", GetHLSLObjectHandleType(context)); + if (Attr) + typeDeclBuilder.getRecordDecl()->addAttr(Attr); + if (isCompleteType) return typeDeclBuilder.completeDefinition(); return typeDeclBuilder.getRecordDecl(); @@ -939,11 +943,9 @@ CXXRecordDecl *hlsl::DeclareTemplateTypeWithHandleInDeclContext( QualType elementType = context.getTemplateTypeParmType( /*templateDepth*/ 0, 0, ParameterPackFalse, elementTemplateParamDecl); - if (templateArgCount > 1 && - // Only need array type for inputpatch and outputpatch. - // Avoid Texture2DMS which may use 0 count. - // TODO: use hlsl types to do the check. - !name.startswith("Texture") && !name.startswith("RWTexture")) { + // Only need array type for inputpatch and outputpatch. + if (Attr && isa(Attr)) { + DXASSERT(templateArgCount == 2, "Tess patches need 2 template params"); Expr *countExpr = DeclRefExpr::Create( context, NestedNameSpecifierLoc(), NoLoc, countTemplateParamDecl, false, DeclarationNameInfo(countTemplateParamDecl->getDeclName(), NoLoc), @@ -1099,22 +1101,25 @@ CXXMethodDecl *hlsl::CreateObjectFunctionDeclarationWithParams( CXXRecordDecl *hlsl::DeclareUIntTemplatedTypeWithHandle( ASTContext &context, StringRef typeName, StringRef templateParamName, - TagTypeKind tagKind) { + InheritableAttr *Attr) { return DeclareUIntTemplatedTypeWithHandleInDeclContext( context, context.getTranslationUnitDecl(), typeName, templateParamName, - tagKind); + Attr); } CXXRecordDecl *hlsl::DeclareUIntTemplatedTypeWithHandleInDeclContext( ASTContext &context, DeclContext *declContext, StringRef typeName, - StringRef templateParamName, TagTypeKind tagKind) { + StringRef templateParamName, InheritableAttr *Attr) { // template FeedbackTexture2D[Array] { ... } - BuiltinTypeDeclBuilder typeDeclBuilder(declContext, typeName, tagKind); + BuiltinTypeDeclBuilder typeDeclBuilder(declContext, typeName, TagTypeKind::TTK_Class); typeDeclBuilder.addIntegerTemplateParam(templateParamName, context.UnsignedIntTy); typeDeclBuilder.startDefinition(); typeDeclBuilder.addField( "h", context.UnsignedIntTy); // Add an 'h' field to hold the handle. + if (Attr) + typeDeclBuilder.getRecordDecl()->addAttr(Attr); + return typeDeclBuilder.getRecordDecl(); } @@ -1136,7 +1141,8 @@ hlsl::DeclareConstantBufferViewType(clang::ASTContext &context, bool bTBuf) { "h", context.UnsignedIntTy); // Add an 'h' field to hold the handle. typeDeclBuilder.getRecordDecl()->addAttr( - HLSLCBufferAttr::CreateImplicit(context)); + HLSLResourceAttr::CreateImplicit(context, (unsigned)DXIL::ResourceKind::CBuffer, + (unsigned)DXIL::ResourceClass::CBuffer)); typeDeclBuilder.getRecordDecl(); diff --git a/tools/clang/lib/AST/HlslTypes.cpp b/tools/clang/lib/AST/HlslTypes.cpp index d83b307463..5f7e93fbee 100644 --- a/tools/clang/lib/AST/HlslTypes.cpp +++ b/tools/clang/lib/AST/HlslTypes.cpp @@ -474,160 +474,73 @@ clang::QualType GetHLSLMatElementType(clang::QualType type) { QualType elemTy = arg0.getAsType(); return elemTy; } + + +template +static AttrType *getAttr(clang::QualType type) { + type = type.getCanonicalType(); + if (const RecordType *RT = type->getAs()) { + if (const auto *Spec = + dyn_cast(RT->getDecl())) + if (const auto *Template = + dyn_cast(Spec->getSpecializedTemplate())) + return Template->getTemplatedDecl()->getAttr(); + if (const auto *Decl = dyn_cast(RT->getDecl())) + return Decl->getAttr(); + } + return nullptr; +} + // TODO: Add type cache to ASTContext. bool IsHLSLInputPatchType(QualType type) { type = type.getCanonicalType(); - if (const RecordType *RT = dyn_cast(type)) { - if (const ClassTemplateSpecializationDecl *templateDecl = - dyn_cast( - RT->getAsCXXRecordDecl())) { - if (templateDecl->getName() == "InputPatch") { - return true; - } - } - } + if (const HLSLTessPatchAttr *Attr = getAttr(type)) + return Attr->getIsInput(); return false; } + bool IsHLSLOutputPatchType(QualType type) { type = type.getCanonicalType(); - if (const RecordType *RT = dyn_cast(type)) { - if (const ClassTemplateSpecializationDecl *templateDecl = - dyn_cast( - RT->getAsCXXRecordDecl())) { - if (templateDecl->getName() == "OutputPatch") { - return true; - } - } - } + if (const HLSLTessPatchAttr *Attr = getAttr(type)) + return !Attr->getIsInput(); return false; } + bool IsHLSLPointStreamType(QualType type) { type = type.getCanonicalType(); - if (const RecordType *RT = dyn_cast(type)) { - if (const ClassTemplateSpecializationDecl *templateDecl = - dyn_cast( - RT->getAsCXXRecordDecl())) { - if (templateDecl->getName() == "PointStream") - return true; - } - } + if (const HLSLStreamOutputAttr *Attr = getAttr(type)) + return Attr->getVertices() == 1; return false; } + bool IsHLSLLineStreamType(QualType type) { type = type.getCanonicalType(); - if (const RecordType *RT = dyn_cast(type)) { - if (const ClassTemplateSpecializationDecl *templateDecl = - dyn_cast( - RT->getAsCXXRecordDecl())) { - if (templateDecl->getName() == "LineStream") - return true; - } - } + if (const HLSLStreamOutputAttr *Attr = getAttr(type)) + return Attr->getVertices() == 2; return false; } + bool IsHLSLTriangleStreamType(QualType type) { type = type.getCanonicalType(); - if (const RecordType *RT = dyn_cast(type)) { - if (const ClassTemplateSpecializationDecl *templateDecl = - dyn_cast( - RT->getAsCXXRecordDecl())) { - if (templateDecl->getName() == "TriangleStream") - return true; - } - } + if (const HLSLStreamOutputAttr *Attr = getAttr(type)) + return Attr->getVertices() == 3; return false; } + bool IsHLSLStreamOutputType(QualType type) { - type = type.getCanonicalType(); - if (const RecordType *RT = dyn_cast(type)) { - if (const ClassTemplateSpecializationDecl *templateDecl = - dyn_cast( - RT->getAsCXXRecordDecl())) { - if (templateDecl->getName() == "PointStream") - return true; - if (templateDecl->getName() == "LineStream") - return true; - if (templateDecl->getName() == "TriangleStream") - return true; - } - } + if (getAttr(type)) + return true; return false; } -bool IsHLSLResourceType(clang::QualType type) { - if (const RecordType *RT = type->getAs()) { - StringRef name = RT->getDecl()->getName(); - if (name == "Texture1D" || name == "RWTexture1D") - return true; - if (name == "Texture2D" || name == "RWTexture2D") - return true; - if (name == "Texture2DMS" || name == "RWTexture2DMS") - return true; - if (name == "Texture3D" || name == "RWTexture3D") - return true; - if (name == "TextureCube" || name == "RWTextureCube") - return true; - - if (name == "Texture1DArray" || name == "RWTexture1DArray") - return true; - if (name == "Texture2DArray" || name == "RWTexture2DArray") - return true; - if (name == "Texture2DMSArray" || name == "RWTexture2DMSArray") - return true; - if (name == "TextureCubeArray" || name == "RWTextureCubeArray") - return true; - - if (name == "FeedbackTexture2D" || name == "FeedbackTexture2DArray") - return true; - - if (name == "RasterizerOrderedTexture1D" || - name == "RasterizerOrderedTexture2D" || - name == "RasterizerOrderedTexture3D" || - name == "RasterizerOrderedTexture1DArray" || - name == "RasterizerOrderedTexture2DArray" || - name == "RasterizerOrderedBuffer" || - name == "RasterizerOrderedByteAddressBuffer" || - name == "RasterizerOrderedStructuredBuffer") - return true; - - if (name == "ByteAddressBuffer" || name == "RWByteAddressBuffer") - return true; - - if (name == "StructuredBuffer" || name == "RWStructuredBuffer") - return true; - - if (name == "AppendStructuredBuffer" || name == "ConsumeStructuredBuffer") - return true; - - if (name == "Buffer" || name == "RWBuffer") - return true; - - if (name == "SamplerState" || name == "SamplerComparisonState") - return true; - if (name == "ConstantBuffer" || name == "TextureBuffer") - return true; - - if (name == "RaytracingAccelerationStructure") - return true; - } +bool IsHLSLResourceType(clang::QualType type) { + if (getAttr(type)) + return true; return false; } -static HLSLNodeObjectAttr *getNodeAttr(clang::QualType type) { - if (const RecordType *RT = type->getAs()) { - if (const auto *Spec = - dyn_cast(RT->getDecl())) - if (const auto *Template = - dyn_cast(Spec->getSpecializedTemplate())) - return Template->getTemplatedDecl()->getAttr(); - if (const auto *Decl = dyn_cast(RT->getDecl())) - return Decl->getAttr(); - } - return nullptr; -} - DXIL::NodeIOKind GetNodeIOType(clang::QualType type) { - if (const HLSLNodeObjectAttr *Attr = getNodeAttr(type)) + if (const HLSLNodeObjectAttr *Attr = getAttr(type)) return Attr->getNodeIOType(); return DXIL::NodeIOKind::Invalid; } @@ -654,27 +567,20 @@ bool IsHLSLDynamicSamplerType(clang::QualType type) { } bool IsHLSLNodeType(clang::QualType type) { - if (const HLSLNodeObjectAttr *Attr = getNodeAttr(type)) + if (const HLSLNodeObjectAttr *Attr = getAttr(type)) return true; return false; } bool IsHLSLObjectWithImplicitMemberAccess(clang::QualType type) { - if (const RecordType *RT = type->getAs()) { - StringRef name = RT->getDecl()->getName(); - if (name == "ConstantBuffer" || name == "TextureBuffer") - return true; - } + if (const HLSLResourceAttr *Attr = getAttr(type)) + return Attr->getResClass() == (unsigned)DXIL::ResourceClass::CBuffer; return false; } bool IsHLSLObjectWithImplicitROMemberAccess(clang::QualType type) { - if (const RecordType *RT = type->getAs()) { - StringRef name = RT->getDecl()->getName(); - // Read-only records - if (name == "ConstantBuffer" || name == "TextureBuffer") - return true; - } + if (const HLSLResourceAttr *Attr = getAttr(type)) + return Attr->getResClass() == (unsigned)DXIL::ResourceClass::CBuffer; return false; } @@ -701,14 +607,8 @@ bool IsHLSLNodeOutputType(clang::QualType type) { } bool IsHLSLStructuredBufferType(clang::QualType type) { - if (const RecordType *RT = type->getAs()) { - StringRef name = RT->getDecl()->getName(); - if (name == "StructuredBuffer" || name == "RWStructuredBuffer") - return true; - - if (name == "AppendStructuredBuffer" || name == "ConsumeStructuredBuffer") - return true; - } + if (const HLSLResourceAttr *Attr = getAttr(type)) + return Attr->getResKind() == (unsigned)DXIL::ResourceKind::StructuredBuffer; return false; } diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index 0665d7441e..57eb388893 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -363,6 +363,8 @@ enum ArBasicKind { #define IS_BPROP_STREAM(_Props) (((_Props)&BPROP_STREAM) != 0) +#define IS_BPROP_PATCH(_Props) (((_Props) & BPROP_PATCH) != 0) + #define IS_BPROP_SAMPLER(_Props) (((_Props)&BPROP_SAMPLER) != 0) #define IS_BPROP_TEXTURE(_Props) (((_Props)&BPROP_TEXTURE) != 0) @@ -616,6 +618,8 @@ C_ASSERT(ARRAYSIZE(g_uBasicKindProps) == AR_BASIC_MAXIMUM_COUNT); #define IS_BASIC_STREAM(_Kind) IS_BPROP_STREAM(GetBasicKindProps(_Kind)) +#define IS_BASIC_PATCH(_Kind) IS_BPROP_PATCH(GetBasicKindProps(_Kind)) + #define IS_BASIC_SAMPLER(_Kind) IS_BPROP_SAMPLER(GetBasicKindProps(_Kind)) #define IS_BASIC_TEXTURE(_Kind) IS_BPROP_TEXTURE(GetBasicKindProps(_Kind)) #define IS_BASIC_OBJECT(_Kind) IS_BPROP_OBJECT(GetBasicKindProps(_Kind)) @@ -3540,6 +3544,20 @@ class HLSLExternalSource : public ExternalSemaSource { if (kind == AR_OBJECT_LEGACY_EFFECT) effectKindIndex = i; + InheritableAttr *Attr = nullptr; + if (IS_BASIC_STREAM(kind)) + Attr = + HLSLStreamOutputAttr::CreateImplicit(*m_context, + kind - AR_OBJECT_POINTSTREAM + 1); + else if (IS_BASIC_PATCH(kind)) + Attr = HLSLTessPatchAttr::CreateImplicit(*m_context, kind == AR_OBJECT_INPUTPATCH); + else { + DXIL::ResourceKind ResKind = DXIL::ResourceKind::NumEntries; + DXIL::ResourceClass ResClass = DXIL::ResourceClass::Invalid; + if (GetBasicKindResourceKindAndClass(kind, ResKind, ResClass)) + Attr = HLSLResourceAttr::CreateImplicit(*m_context, (unsigned)ResKind, + (unsigned)ResClass); + } DXASSERT(kind < _countof(g_ArBasicTypeNames), "g_ArBasicTypeNames has the wrong number of entries"); assert(kind < _countof(g_ArBasicTypeNames)); @@ -3609,10 +3627,10 @@ class HLSLExternalSource : public ExternalSemaSource { } } else if (kind == AR_OBJECT_FEEDBACKTEXTURE2D) { recordDecl = DeclareUIntTemplatedTypeWithHandle( - *m_context, "FeedbackTexture2D", "kind"); + *m_context, "FeedbackTexture2D", "kind", Attr); } else if (kind == AR_OBJECT_FEEDBACKTEXTURE2D_ARRAY) { recordDecl = DeclareUIntTemplatedTypeWithHandle( - *m_context, "FeedbackTexture2DArray", "kind"); + *m_context, "FeedbackTexture2DArray", "kind", Attr); } else if (kind == AR_OBJECT_EMPTY_NODE_INPUT) { recordDecl = DeclareNodeOrRecordType( *m_context, DXIL::NodeIOKind::EmptyInput, @@ -3729,20 +3747,11 @@ class HLSLExternalSource : public ExternalSemaSource { #endif else if (templateArgCount == 0) { recordDecl = DeclareRecordTypeWithHandle(*m_context, typeName, - /*isCompleteType*/ false); + /*isCompleteType*/ false, + Attr); } else { DXASSERT(templateArgCount == 1 || templateArgCount == 2, "otherwise a new case has been added"); - - InheritableAttr *Attr = nullptr; - DXIL::ResourceKind ResKind = DXIL::ResourceKind::NumEntries; - DXIL::ResourceClass ResClass = DXIL::ResourceClass::Invalid; - if (GetBasicKindResourceKindAndClass(kind, ResKind, ResClass)) - Attr = HLSLResourceAttr::CreateImplicit(*m_context, (unsigned)ResKind, - (unsigned)ResClass); - else if (kind == AR_OBJECT_INPUTPATCH || kind == AR_OBJECT_OUTPUTPATCH) - Attr = HLSLTessPatchAttr::CreateImplicit(*m_context); - TypeSourceInfo *typeDefault = TemplateHasDefaultType(kind) ? float4TypeSourceInfo : nullptr; recordDecl = DeclareTemplateTypeWithHandle( @@ -4755,6 +4764,15 @@ class HLSLExternalSource : public ExternalSemaSource { ResKind = DXIL::ResourceKind::FeedbackTexture2DArray; ResClass = DXIL::ResourceClass::SRV; return true; + case AR_OBJECT_SAMPLER: + case AR_OBJECT_SAMPLERCOMPARISON: + ResKind = DXIL::ResourceKind::Sampler; + ResClass = DXIL::ResourceClass::Sampler; + return true; + case AR_OBJECT_ACCELERATION_STRUCT: + ResKind = DXIL::ResourceKind::RTAccelerationStructure; + ResClass = DXIL::ResourceClass::SRV; + return true; default: return false; } @@ -5217,7 +5235,9 @@ class HLSLExternalSource : public ExternalSemaSource { return false; } // Allow object type for Constant/TextureBuffer. - if (Template->getTemplatedDecl()->hasAttr()) { + HLSLResourceAttr *ResAttr = + Template->getTemplatedDecl()->getAttr(); + if (ResAttr && ResAttr->getResClass() == (unsigned)DXIL::ResourceClass::CBuffer) { if (TemplateArgList.size() == 1) { const TemplateArgumentLoc &argLoc = TemplateArgList[0]; const TemplateArgument &arg = argLoc.getArgument(); @@ -5326,7 +5346,8 @@ class HLSLExternalSource : public ExternalSemaSource { "Tessellation patch should have at least one template args"); const TemplateArgumentLoc &argLoc = TemplateArgList[0]; const TemplateArgument &arg = argLoc.getArgument(); - DXASSERT(arg.getKind() == TemplateArgument::ArgKind::Type, ""); + DXASSERT(arg.getKind() == TemplateArgument::ArgKind::Type, + "Tessellation patch requires type template arg 0"); QualType argType = arg.getAsType(); if (HasLongVecs(argType)) { m_sema->Diag(argLoc.getLocation(), @@ -5334,7 +5355,22 @@ class HLSLExternalSource : public ExternalSemaSource { << "tessellation patches"; return true; } + } else if (Template->getTemplatedDecl()->hasAttr()) { + DXASSERT(TemplateArgList.size() > 0, + "Geometry streams should have at least one template args"); + const TemplateArgumentLoc &argLoc = TemplateArgList[0]; + const TemplateArgument &arg = argLoc.getArgument(); + DXASSERT(arg.getKind() == TemplateArgument::ArgKind::Type, + "Geometry stream requires type template arg 0"); + QualType argType = arg.getAsType(); + if (HasLongVecs(argType)) { + m_sema->Diag(argLoc.getLocation(), + diag::err_hlsl_unsupported_long_vector) + << "geometry streams"; + return true; + } } + bool isMatrix = Template->getCanonicalDecl() == m_matrixTemplateDecl->getCanonicalDecl(); bool isVector = Template->getCanonicalDecl() == @@ -5354,8 +5390,6 @@ class HLSLExternalSource : public ExternalSemaSource { // NOTE: IsValidTemplateArgumentType emits its own diagnostics return true; } - HLSLResourceAttr *ResAttr = - Template->getTemplatedDecl()->getAttr(); if (ResAttr && IsTyped((DXIL::ResourceKind)ResAttr->getResKind())) { // Check vectors for being too large. if (IsVectorType(m_sema, argType)) { From de6ac33353314da64d9f56154d7a428fcd2f320e Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Thu, 20 Feb 2025 19:11:31 -0700 Subject: [PATCH 05/45] Respond to feedback Add setting for max vec size. Determine long vector presence using DefinitionData bit? OR Rename testing for long vecs function? Add attribute for geometry streams, produce and test errors for long vectors there. Add and test errors for > 1024 element vectors. Add vector size to error messages good test changes --- include/dxc/DXIL/DxilConstants.h | 2 + .../clang/Basic/DiagnosticSemaKinds.td | 8 ++- tools/clang/include/clang/Basic/LangOptions.h | 3 +- tools/clang/include/clang/Sema/SemaHLSL.h | 2 +- tools/clang/lib/Sema/SemaDXR.cpp | 5 +- tools/clang/lib/Sema/SemaHLSL.cpp | 65 ++++++++++--------- tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp | 7 +- .../clang/tools/dxcompiler/dxcompilerobj.cpp | 7 ++ 8 files changed, 59 insertions(+), 40 deletions(-) diff --git a/include/dxc/DXIL/DxilConstants.h b/include/dxc/DXIL/DxilConstants.h index f8d5b740f7..ac894df1d6 100644 --- a/include/dxc/DXIL/DxilConstants.h +++ b/include/dxc/DXIL/DxilConstants.h @@ -147,6 +147,8 @@ const unsigned kMaxMSTotalSigRows = 32; const unsigned kMaxMSSMSize = 1024 * 28; const unsigned kMinWaveSize = 4; const unsigned kMaxWaveSize = 128; +const unsigned kDefaultMaxVectorLength = 4; +const unsigned kSM69MaxVectorLength = 1024; const float kMaxMipLodBias = 15.99f; const float kMinMipLodBias = -16.0f; diff --git a/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td b/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td index 441509d4c5..4d81b25ccc 100644 --- a/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -7519,8 +7519,8 @@ def err_hlsl_half_load_store: Error< "LoadHalf and StoreHalf are not supported for min precision mode">; def err_hlsl_interfaces_cannot_inherit: Error< "interfaces cannot inherit from other types">; -def err_hlsl_invalid_range_1_4: Error< - "invalid value, valid range is between 1 and 4 inclusive">; +def err_hlsl_invalid_range_1_plus: Error< + "invalid value, valid range is between 1 and %0 inclusive">; def err_hlsl_matrix_member_bad_format: Error< "invalid format for matrix subscript '%0'">; def err_hlsl_matrix_member_empty: Error< @@ -7852,7 +7852,9 @@ def err_hlsl_load_from_mesh_out_arrays: Error< def err_hlsl_out_indices_array_incorrect_access: Error< "a vector in out indices array must be accessed as a whole">; def err_hlsl_unsupported_long_vector: Error< - "Vectors of over 4 elements in %0 are not supported">; + "Vectors of over %0 elements in %1 are not supported">; +def err_hlsl_vector_too_long: Error< + "Vectors of over %0 elements in are not supported">; def err_hlsl_logical_binop_scalar : Error< "operands for short-circuiting logical binary operator must be scalar, for non-scalar types use '%select{and|or}0'">; def err_hlsl_ternary_scalar : Error< diff --git a/tools/clang/include/clang/Basic/LangOptions.h b/tools/clang/include/clang/Basic/LangOptions.h index 8dc15da5d8..433b767c8d 100644 --- a/tools/clang/include/clang/Basic/LangOptions.h +++ b/tools/clang/include/clang/Basic/LangOptions.h @@ -15,7 +15,7 @@ #ifndef LLVM_CLANG_BASIC_LANGOPTIONS_H #define LLVM_CLANG_BASIC_LANGOPTIONS_H -#include "dxc/DXIL/DxilConstants.h" // For DXIL::DefaultLinkage +#include "dxc/DXIL/DxilConstants.h" // For DXIL:: default values. #include "dxc/Support/HLSLVersion.h" #include "clang/Basic/CommentOptions.h" #include "clang/Basic/LLVM.h" @@ -168,6 +168,7 @@ class LangOptions : public LangOptionsBase { hlsl::DXIL::DefaultLinkage::Default; /// Whether use row major as default matrix major. bool HLSLDefaultRowMajor = false; + unsigned MaxHLSLVectorLength = hlsl::DXIL::kDefaultMaxVectorLength; // HLSL Change Ends bool SPIRV = false; // SPIRV Change diff --git a/tools/clang/include/clang/Sema/SemaHLSL.h b/tools/clang/include/clang/Sema/SemaHLSL.h index c52131b8a5..786f82933d 100644 --- a/tools/clang/include/clang/Sema/SemaHLSL.h +++ b/tools/clang/include/clang/Sema/SemaHLSL.h @@ -128,7 +128,7 @@ unsigned CaculateInitListArraySizeForHLSL(clang::Sema *sema, const clang::InitListExpr *InitList, const clang::QualType EltTy); -bool HasLongVecs(const clang::QualType &qt); +bool ContainsVectorLongerThan(const clang::QualType &qt, unsigned length); bool IsConversionToLessOrEqualElements(clang::Sema *self, const clang::ExprResult &sourceExpr, diff --git a/tools/clang/lib/Sema/SemaDXR.cpp b/tools/clang/lib/Sema/SemaDXR.cpp index cb16ced5df..07234554e2 100644 --- a/tools/clang/lib/Sema/SemaDXR.cpp +++ b/tools/clang/lib/Sema/SemaDXR.cpp @@ -810,9 +810,10 @@ void DiagnoseTraceCall(Sema &S, const VarDecl *Payload, return; } - if (hlsl::HasLongVecs(Payload->getType())) { + if (hlsl::ContainsVectorLongerThan(Payload->getType(), + DXIL::kDefaultMaxVectorLength)) { S.Diag(Payload->getLocation(), diag::err_hlsl_unsupported_long_vector) - << "payload parameters"; + << DXIL::kDefaultMaxVectorLength << "payload parameters"; return; } diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index 57eb388893..fe3390a89e 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -5207,12 +5207,13 @@ class HLSLExternalSource : public ExternalSemaSource { SourceLocation Loc); bool CheckRangedTemplateArgument(SourceLocation diagLoc, - llvm::APSInt &sintValue) { - const auto *SM = - hlsl::ShaderModel::GetByName(m_sema->getLangOpts().HLSLProfile.c_str()); + llvm::APSInt &sintValue, bool IsVector) { + unsigned MaxLength = DXIL::kDefaultMaxVectorLength; + if (IsVector) + MaxLength = m_sema->getLangOpts().MaxHLSLVectorLength; if (!sintValue.isStrictlyPositive() || - (sintValue.getLimitedValue() > 4 && !SM->IsSM69Plus())) { - m_sema->Diag(diagLoc, diag::err_hlsl_invalid_range_1_4); + sintValue.getLimitedValue() > MaxLength) { + m_sema->Diag(diagLoc, diag::err_hlsl_invalid_range_1_plus) << MaxLength; return true; } @@ -5252,9 +5253,9 @@ class HLSLExternalSource : public ExternalSemaSource { << argType; return true; } - if (HasLongVecs(argType)) { + if (ContainsVectorLongerThan(argType, DXIL::kDefaultMaxVectorLength)) { m_sema->Diag(argSrcLoc, diag::err_hlsl_unsupported_long_vector) - << "cbuffers"; + << DXIL::kDefaultMaxVectorLength << "cbuffers"; return true; } @@ -5349,10 +5350,10 @@ class HLSLExternalSource : public ExternalSemaSource { DXASSERT(arg.getKind() == TemplateArgument::ArgKind::Type, "Tessellation patch requires type template arg 0"); QualType argType = arg.getAsType(); - if (HasLongVecs(argType)) { + if (ContainsVectorLongerThan(argType, DXIL::kDefaultMaxVectorLength)) { m_sema->Diag(argLoc.getLocation(), diag::err_hlsl_unsupported_long_vector) - << "tessellation patches"; + << DXIL::kDefaultMaxVectorLength << "tessellation patches"; return true; } } else if (Template->getTemplatedDecl()->hasAttr()) { @@ -5363,10 +5364,10 @@ class HLSLExternalSource : public ExternalSemaSource { DXASSERT(arg.getKind() == TemplateArgument::ArgKind::Type, "Geometry stream requires type template arg 0"); QualType argType = arg.getAsType(); - if (HasLongVecs(argType)) { + if (ContainsVectorLongerThan(argType, DXIL::kDefaultMaxVectorLength)) { m_sema->Diag(argLoc.getLocation(), diag::err_hlsl_unsupported_long_vector) - << "geometry streams"; + << DXIL::kDefaultMaxVectorLength << "geometry streams"; return true; } } @@ -5419,17 +5420,16 @@ class HLSLExternalSource : public ExternalSemaSource { llvm::APSInt constantResult; if (expr != nullptr && expr->isIntegerConstantExpr(constantResult, *m_context)) { - if (CheckRangedTemplateArgument(argSrcLoc, constantResult)) { + if (CheckRangedTemplateArgument(argSrcLoc, constantResult, + isVector)) return true; - } } } } else if (arg.getKind() == TemplateArgument::ArgKind::Integral) { if (isMatrix || isVector) { llvm::APSInt Val = arg.getAsIntegral(); - if (CheckRangedTemplateArgument(argSrcLoc, Val)) { + if (CheckRangedTemplateArgument(argSrcLoc, Val, isVector)) return true; - } } } } @@ -11633,9 +11633,9 @@ bool hlsl::DiagnoseNodeStructArgument(Sema *self, TemplateArgumentLoc ArgLoc, ArTypeObjectKind shapeKind = source->GetTypeObjectKind(ArgTy); switch (shapeKind) { case AR_TOBJ_VECTOR: - if (GetHLSLVecSize(ArgTy) > 4) { + if (GetHLSLVecSize(ArgTy) > DXIL::kDefaultMaxVectorLength) { self->Diag(ArgLoc.getLocation(), diag::err_hlsl_unsupported_long_vector) - << "node records"; + << DXIL::kDefaultMaxVectorLength << "node records"; Empty = false; return false; } @@ -12104,17 +12104,16 @@ bool hlsl::ShouldSkipNRVO(clang::Sema &sema, clang::QualType returnType, return false; } -bool hlsl::HasLongVecs(const QualType &qt) { - if (qt.isNull()) { +bool hlsl::ContainsVectorLongerThan(const QualType &qt, unsigned length) { + if (qt.isNull()) return false; - } if (IsHLSLVecType(qt)) { - if (GetHLSLVecSize(qt) > 4) + if (GetHLSLVecSize(qt) > length) return true; } else if (qt->isArrayType()) { const ArrayType *arrayType = qt->getAsArrayTypeUnsafe(); - return HasLongVecs(arrayType->getElementType()); + return ContainsVectorLongerThan(arrayType->getElementType(), length); } else if (qt->isStructureOrClassType()) { const RecordType *recordType = qt->getAs(); const RecordDecl *recordDecl = recordType->getDecl(); @@ -12124,7 +12123,7 @@ bool hlsl::HasLongVecs(const QualType &qt) { RecordDecl::field_iterator end = recordDecl->field_end(); for (; begin != end; begin++) { const FieldDecl *fieldDecl = *begin; - if (HasLongVecs(fieldDecl->getType())) + if (ContainsVectorLongerThan(fieldDecl->getType(), length)) return true; } } @@ -14760,8 +14759,10 @@ bool Sema::DiagnoseHLSLDecl(Declarator &D, DeclContext *DC, Expr *BitWidth, } // Disallow long vecs from cbuffers. - if (isGlobal && !isStatic && !isGroupShared && HasLongVecs(qt)) { - Diag(D.getLocStart(), diag::err_hlsl_unsupported_long_vector) << "cbuffers"; + if (isGlobal && !isStatic && !isGroupShared && + ContainsVectorLongerThan(qt, DXIL::kDefaultMaxVectorLength)) { + Diag(D.getLocStart(), diag::err_hlsl_unsupported_long_vector) + << DXIL::kDefaultMaxVectorLength << "cbuffers"; result = false; } @@ -15655,9 +15656,9 @@ static bool isRelatedDeclMarkedNointerpolation(Expr *E) { // Verify that user-defined intrinsic struct args contain no long vectors static bool CheckUDTIntrinsicArg(Sema *S, Expr *Arg) { - if (HasLongVecs(Arg->getType())) { + if (ContainsVectorLongerThan(Arg->getType(), DXIL::kDefaultMaxVectorLength)) { S->Diag(Arg->getExprLoc(), diag::err_hlsl_unsupported_long_vector) - << "user-defined struct parameter"; + << DXIL::kDefaultMaxVectorLength << "user-defined struct parameter"; return true; } return false; @@ -16396,13 +16397,15 @@ void DiagnoseEntry(Sema &S, FunctionDecl *FD) { // Check general parameter characteristics // Would be nice to check for resources here as they crash the compiler now. for (const auto *param : FD->params()) - if (HasLongVecs(param->getType())) + if (ContainsVectorLongerThan(param->getType(), + DXIL::kDefaultMaxVectorLength)) S.Diag(param->getLocation(), diag::err_hlsl_unsupported_long_vector) - << "entry function parameters"; + << DXIL::kDefaultMaxVectorLength << "entry function parameters"; - if (HasLongVecs(FD->getReturnType())) + if (ContainsVectorLongerThan(FD->getReturnType(), + DXIL::kDefaultMaxVectorLength)) S.Diag(FD->getLocation(), diag::err_hlsl_unsupported_long_vector) - << "entry function return type"; + << DXIL::kDefaultMaxVectorLength << "entry function return type"; DXIL::ShaderKind Stage = ShaderModel::KindFromFullName(shaderAttr->getStage()); diff --git a/tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp b/tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp index ee5ea567ce..adb2352a56 100644 --- a/tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp +++ b/tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp @@ -521,14 +521,17 @@ void hlsl::DiagnoseTranslationUnit(clang::Sema *self) { } } for (const auto *param : pPatchFnDecl->params()) - if (HasLongVecs(param->getType())) + if (ContainsVectorLongerThan(param->getType(), + DXIL::kDefaultMaxVectorLength)) self->Diag(param->getLocation(), diag::err_hlsl_unsupported_long_vector) + << DXIL::kDefaultMaxVectorLength << "patch constant function parameters"; - if (HasLongVecs(pPatchFnDecl->getReturnType())) + if (ContainsVectorLongerThan(pPatchFnDecl->getReturnType(), 4)) self->Diag(pPatchFnDecl->getLocation(), diag::err_hlsl_unsupported_long_vector) + << DXIL::kDefaultMaxVectorLength << "patch constant function return type"; } diff --git a/tools/clang/tools/dxcompiler/dxcompilerobj.cpp b/tools/clang/tools/dxcompiler/dxcompilerobj.cpp index c1c844d4be..11effb645b 100644 --- a/tools/clang/tools/dxcompiler/dxcompilerobj.cpp +++ b/tools/clang/tools/dxcompiler/dxcompilerobj.cpp @@ -1440,6 +1440,13 @@ class DxcCompiler : public IDxcCompiler3, Opts.EnablePayloadQualifiers; compiler.getLangOpts().HLSLProfile = compiler.getCodeGenOpts().HLSLProfile = Opts.TargetProfile; + const ShaderModel *SM = hlsl::ShaderModel::GetByName( + compiler.getLangOpts().HLSLProfile.c_str()); + if (SM->IsSM69Plus()) + compiler.getLangOpts().MaxHLSLVectorLength = DXIL::kSM69MaxVectorLength; + else + compiler.getLangOpts().MaxHLSLVectorLength = + DXIL::kDefaultMaxVectorLength; // Enable dumping implicit top level decls either if it was specifically // requested or if we are not dumping the ast from the command line. That From 76dde0d016eb183d36d97adb14f6058b4118921d Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Sun, 2 Mar 2025 23:49:18 -0700 Subject: [PATCH 06/45] Reaname and consolidate longvecs tests Go for consistent test filename formatting. most LLVM tests have dashes, so dashes it is. Remove redundant sm68 test --- ...{longvec_decls.hlsl => longvec-decls.hlsl} | 0 ..._hs.hlsl => invalid-longvec-decls-hs.hlsl} | 0 ..._decls.hlsl => invalid-longvec-decls.hlsl} | 0 ...s_sm68.hlsl => invalid-longvecs-sm68.hlsl} | 0 .../hlsl/types/invalid_longvec_decls_68.hlsl | 108 ------------------ 5 files changed, 108 deletions(-) rename tools/clang/test/CodeGenDXIL/hlsl/types/{longvec_decls.hlsl => longvec-decls.hlsl} (100%) rename tools/clang/test/SemaHLSL/hlsl/types/{invalid_longvec_decls_hs.hlsl => invalid-longvec-decls-hs.hlsl} (100%) rename tools/clang/test/SemaHLSL/hlsl/types/{invalid_longvec_decls.hlsl => invalid-longvec-decls.hlsl} (100%) rename tools/clang/test/SemaHLSL/hlsl/types/{invalid_longvecs_sm68.hlsl => invalid-longvecs-sm68.hlsl} (100%) delete mode 100644 tools/clang/test/SemaHLSL/hlsl/types/invalid_longvec_decls_68.hlsl diff --git a/tools/clang/test/CodeGenDXIL/hlsl/types/longvec_decls.hlsl b/tools/clang/test/CodeGenDXIL/hlsl/types/longvec-decls.hlsl similarity index 100% rename from tools/clang/test/CodeGenDXIL/hlsl/types/longvec_decls.hlsl rename to tools/clang/test/CodeGenDXIL/hlsl/types/longvec-decls.hlsl diff --git a/tools/clang/test/SemaHLSL/hlsl/types/invalid_longvec_decls_hs.hlsl b/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls-hs.hlsl similarity index 100% rename from tools/clang/test/SemaHLSL/hlsl/types/invalid_longvec_decls_hs.hlsl rename to tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls-hs.hlsl diff --git a/tools/clang/test/SemaHLSL/hlsl/types/invalid_longvec_decls.hlsl b/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls.hlsl similarity index 100% rename from tools/clang/test/SemaHLSL/hlsl/types/invalid_longvec_decls.hlsl rename to tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls.hlsl diff --git a/tools/clang/test/SemaHLSL/hlsl/types/invalid_longvecs_sm68.hlsl b/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvecs-sm68.hlsl similarity index 100% rename from tools/clang/test/SemaHLSL/hlsl/types/invalid_longvecs_sm68.hlsl rename to tools/clang/test/SemaHLSL/hlsl/types/invalid-longvecs-sm68.hlsl diff --git a/tools/clang/test/SemaHLSL/hlsl/types/invalid_longvec_decls_68.hlsl b/tools/clang/test/SemaHLSL/hlsl/types/invalid_longvec_decls_68.hlsl deleted file mode 100644 index 8aac527c1f..0000000000 --- a/tools/clang/test/SemaHLSL/hlsl/types/invalid_longvec_decls_68.hlsl +++ /dev/null @@ -1,108 +0,0 @@ -// RUN: %dxc -DTYPE=float -DNUM=7 -T ps_6_8 -verify %s - -// CHECK: %struct.LongVec = type { <4 x float>, <7 x [[STY:[a-z0-9]*]]> } -struct LongVec { - float4 f; - vector vec; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} -}; - -static vector static_vec; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} -static vector static_vec_arr[10]; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - -groupshared vector gs_vec; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} -groupshared vector gs_vec_arr[10]; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - -export vector lv_param_passthru(vector vec1) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - vector ret = vec1; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - return ret; -} - -export void lv_param_in_out(in vector vec1, out vector vec2) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - vec2 = vec1; -} - -export void lv_param_inout(inout vector vec1, inout vector vec2) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - vector tmp = vec1; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - vec1 = vec2; - vec2 = tmp; -} - -export void lv_global_assign(vector vec) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - static_vec = vec; -} - -export vector lv_global_ret() { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - vector ret = static_vec; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - return ret; -} - -export void lv_gs_assign(vector vec) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - gs_vec = vec; -} - -export vector lv_gs_ret() { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - vector ret = gs_vec; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - return ret; -} - -export vector lv_param_arr_passthru(vector vec)[10] { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - vector ret[10]; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - for (int i = 0; i < 10; i++) - ret[i] = vec; - return ret; -} - -export void lv_global_arr_assign(vector vec[10]) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - for (int i = 0; i < 10; i++) - static_vec_arr[i] = vec[i]; -} - -export vector lv_global_arr_ret()[10] { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - vector ret[10]; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - for (int i = 0; i < 10; i++) - ret[i] = static_vec_arr[i]; - return ret; -} - -export void lv_gs_arr_assign(vector vec[10]) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - for (int i = 0; i < 10; i++) - gs_vec_arr[i] = vec[i]; -} - -export vector lv_gs_arr_ret()[10] { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - vector ret[10]; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - for (int i = 0; i < 10; i++) - ret[i] = gs_vec_arr[i]; - return ret; -} - -export vector lv_splat(TYPE scalar) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - vector ret = scalar; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - return ret; -} - -export vector lv_initlist() { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - vector ret = {1, 2, 3, 4, 5, 6}; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - return ret; -} - -export vector lv_initlist_vec(vector vec) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - vector ret = {vec, 4.0, 5.0, 6.0}; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - return ret; -} - -export vector lv_vec_vec(vector vec1, vector vec2) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - vector ret = {vec1, vec2}; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - return ret; -} - -export vector lv_array_cast(TYPE arr[NUM]) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - vector ret = (vector)arr; // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - return ret; -} - -export vector lv_ctor(TYPE s) { // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - vector ret = vector(1.0, 2.0, 3.0, 4.0, 5.0, s); // expected-error {{invalid value, valid range is between 1 and 4 inclusive}} - return ret; -} - From 765ab1c56eb412afdba517064716b1cccea3ed42 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Sun, 2 Mar 2025 23:03:09 -0700 Subject: [PATCH 07/45] Refactor, clarify, and expand testing Expand existing tests to different target and contexts. Add thorough testing for geometry streams and tessellation patches. Add toolong vector test. Verify that vectors that are over the maximum for 6.9 fail. Add subobjects and template classes to tests. These are unfortunately disabled because the code to make them work causes other tests to fail. --- .../CodeGenDXIL/hlsl/types/longvec-decls.hlsl | 305 +++++++++++------- .../hlsl/types/invalid-longvec-decls.hlsl | 164 +++++++--- .../SemaHLSL/hlsl/types/toolong-vectors.hlsl | 116 +++++++ 3 files changed, 414 insertions(+), 171 deletions(-) create mode 100644 tools/clang/test/SemaHLSL/hlsl/types/toolong-vectors.hlsl diff --git a/tools/clang/test/CodeGenDXIL/hlsl/types/longvec-decls.hlsl b/tools/clang/test/CodeGenDXIL/hlsl/types/longvec-decls.hlsl index d6672e7678..8bc7b9e73d 100644 --- a/tools/clang/test/CodeGenDXIL/hlsl/types/longvec-decls.hlsl +++ b/tools/clang/test/CodeGenDXIL/hlsl/types/longvec-decls.hlsl @@ -1,64 +1,137 @@ -// RUN: %dxc -fcgl -T lib_6_9 -DTYPE=float -DNUM=7 %s | FileCheck %s -// RUN: %dxc -fcgl -T lib_6_9 -DTYPE=bool -DNUM=7 %s | FileCheck %s -// RUN: %dxc -fcgl -T lib_6_9 -DTYPE=uint64_t -DNUM=7 %s | FileCheck %s -// RUN: %dxc -fcgl -T lib_6_9 -DTYPE=double -DNUM=7 %s | FileCheck %s -// RUN: %dxc -fcgl -T lib_6_9 -DTYPE=float16_t -DNUM=7 -enable-16bit-types %s | FileCheck %s -// RUN: %dxc -fcgl -T lib_6_9 -DTYPE=int16_t -DNUM=7 -enable-16bit-types %s | FileCheck %s +// RUN: %dxc -fcgl -T lib_6_9 -DTYPE=float -DNUM=5 %s | FileCheck %s -check-prefixes=CHECK,F5 +// RUN: %dxc -fcgl -T lib_6_9 -DTYPE=bool -DNUM=7 %s | FileCheck %s -check-prefixes=CHECK,B7 +// RUN: %dxc -fcgl -T lib_6_9 -DTYPE=uint64_t -DNUM=9 %s | FileCheck %s -check-prefixes=CHECK,L9 +// RUN: %dxc -fcgl -T lib_6_9 -DTYPE=double -DNUM=17 %s | FileCheck %s -check-prefixes=CHECK,D17 +// RUN: %dxc -fcgl -T lib_6_9 -DTYPE=float16_t -DNUM=256 -enable-16bit-types %s | FileCheck %s -check-prefixes=CHECK,H256 +// RUN: %dxc -fcgl -T lib_6_9 -DTYPE=int16_t -DNUM=1024 -enable-16bit-types %s | FileCheck %s -check-prefixes=CHECK,S1024 // A test to verify that declarations of longvecs are permitted in all the accepted places. // Only tests for acceptance, most codegen is ignored for now. -// CHECK: %struct.LongVec = type { <4 x float>, <7 x [[STY:[a-z0-9]*]]> } +// CHECK: %struct.LongVec = type { <4 x float>, <[[NUM:[0-9]*]] x [[STY:[a-z0-9]*]]> } struct LongVec { float4 f; vector vec; }; +struct LongVecSub : LongVec { + int3 is; +}; + +template +struct LongVecTpl { + float4 f; + vector vec; +}; // Just some dummies to capture the types and mangles. // CHECK: @"\01?dummy@@3[[MNG:F|M|N|_N|_K|\$f16@]]A" = external addrspace(3) global [[STY]] groupshared TYPE dummy; -// CHECK-DAG: @"\01?gs_vec@@3V?$vector@[[MNG]]$06@@A" = external addrspace(3) global <7 x [[STY]]> -// CHECK-DAG: @"\01?gs_vec_arr@@3PAV?$vector@[[MNG]]$06@@A" = external addrspace(3) global [10 x <7 x [[STY]]>] -// CHECK-DAG: @"\01?gs_vec_rec@@3ULongVec@@A" = external addrspace(3) global %struct.LongVec +// Use the first groupshared to establish mangles and sizes +// F5-DAG: @"\01?gs_vec@@3V?$vector@[[MNG:M]]$[[VS:04]]@@A" = external addrspace(3) global <[[NUM]] x [[STY]]> +// B7-DAG: @"\01?gs_vec@@3V?$vector@[[MNG:_N]]$[[VS:06]]@@A" = external addrspace(3) global <[[NUM]] x [[STY]]> +// L9-DAG: @"\01?gs_vec@@3V?$vector@[[MNG:_K]]$[[VS:08]]@@A" = external addrspace(3) global <[[NUM]] x [[STY]]> +// D17-DAG: @"\01?gs_vec@@3V?$vector@[[MNG:N]]$[[VS:0BB@]]@@A" = external addrspace(3) global <[[NUM]] x [[STY]]> +// H256-DAG: @"\01?gs_vec@@3V?$vector@[[MNG:\$f16@]]$[[VS:0BAA@]]@@A" = external addrspace(3) global <[[NUM]] x [[STY]]> +// S1024-DAG: @"\01?gs_vec@@3V?$vector@[[MNG:F]]$[[VS:0EAA@]]@@A" = external addrspace(3) global <[[NUM]] x [[STY]]> groupshared vector gs_vec; + +// CHECK-DAG: @"\01?gs_vec_arr@@3PAV?$vector@[[MNG]]$[[VS]]@@A" = external addrspace(3) global [10 x <[[NUM]] x [[STY]]>] groupshared vector gs_vec_arr[10]; +// CHECK-DAG: @"\01?gs_vec_rec@@3ULongVec@@A" = external addrspace(3) global %struct.LongVec groupshared LongVec gs_vec_rec; +// CHECK-DAG: @"\01?gs_vec_sub@@3ULongVecSub@@A" = external addrspace(3) global %struct.LongVecSub +groupshared LongVecSub gs_vec_sub; +// CHECK-DAG: @"\01?gs_vec_tpl@@3U?$LongVecTpl@$[[VS]]@@A" = external addrspace(3) global %"struct.LongVecTpl<[[NUM]]>" +groupshared LongVecTpl gs_vec_tpl; -// CHECK-DAG: @static_vec = internal global <7 x [[STY]]> -// CHECK-DAG: @static_vec_arr = internal global [10 x <7 x [[STY]]>] zeroinitializer -// CHECK-DAG: @static_vec_rec = internal global %struct.LongVec +// CHECK-DAG: @static_vec = internal global <[[NUM]] x [[STY]]> static vector static_vec; +// CHECK-DAG: @static_vec_arr = internal global [10 x <[[NUM]] x [[STY]]>] zeroinitializer static vector static_vec_arr[10]; +// CHECK-DAG: @static_vec_rec = internal global %struct.LongVec static LongVec static_vec_rec; +// CHECK-DAG: @static_vec_sub = internal global %struct.LongVecSub +static LongVecSub static_vec_sub; +// CHECK-DAG: @static_vec_tpl = internal global %"struct.LongVecTpl<[[NUM]]>" +static LongVecTpl static_vec_tpl; // CHECK: define [[RTY:[a-z0-9]*]] @"\01?getVal@@YA[[MNG]][[MNG]]@Z"([[RTY]] {{.*}}%t) export TYPE getVal(TYPE t) {TYPE ret = dummy; dummy = t; return ret;} -// CHECK: define <7 x [[RTY]]> +// CHECK: define <[[NUM]] x [[RTY]]> // CHECK-LABEL: @"\01?lv_param_passthru -// CHECK-SAME: @@YA?AV?$vector@[[MNG]]$06@@V1@@Z"(<7 x [[RTY]]> %vec1) -// CHECK: ret <7 x [[RTY]]> +// CHECK-SAME: @@YA?AV?$vector@[[MNG]]$[[VS]]@@V1@@Z"(<[[NUM]] x [[RTY]]> %vec1) +// CHECK: ret <[[NUM]] x [[RTY]]> export vector lv_param_passthru(vector vec1) { - vector ret = vec1; - return ret; + return vec1; +} + +// CHECK-LABEL: define void @"\01?lv_param_arr_passthru +// CHECK-SAME: @@YA$$BY09V?$vector@[[MNG]]$[[VS]]@@Y09V1@@Z"([10 x <[[NUM]] x [[STY]]>]* noalias sret %agg.result, [10 x <[[NUM]] x [[STY]]>]* %vec) +// CHECK: ret void +export vector lv_param_arr_passthru(vector vec[10])[10] { + return vec; +} + +// CHECK-LABEL: define void @"\01?lv_param_rec_passthru@@YA?AULongVec@@U1@@Z"(%struct.LongVec* noalias sret %agg.result, %struct.LongVec* %vec) +// CHECK: memcpy +// CHECK: ret void +export LongVec lv_param_rec_passthru(LongVec vec) { + return vec; +} + +// CHECK-LABEL: define void @"\01?lv_param_sub_passthru@@YA?AULongVec@@U1@@Z"(%struct.LongVec* noalias sret %agg.result, %struct.LongVec* %vec) +// CHECK: memcpy +// CHECK: ret void +export LongVec lv_param_sub_passthru(LongVec vec) { + return vec; +} + +// CHECK-LABEL: define void @"\01?lv_param_tpl_passthru@@YA?AULongVec@@U1@@Z"(%struct.LongVec* noalias sret %agg.result, %struct.LongVec* %vec) +// CHECK: memcpy +// CHECK: ret void +export LongVec lv_param_tpl_passthru(LongVec vec) { + return vec; } // CHECK-LABEL: define void @"\01?lv_param_in_out -// CHECK-SAME: @@YAXV?$vector@[[MNG]]$06@@AIAV1@@Z"(<7 x [[RTY]]> %vec1, <7 x [[STY]]>* noalias dereferenceable({{[0-9]*}}) %vec2) -// CHECK: store <7 x [[STY]]> {{%.*}}, <7 x [[STY]]>* %vec2, align 4 +// CHECK-SAME: @@YAXV?$vector@[[MNG]]$[[VS]]@@AIAV1@@Z"(<[[NUM]] x [[RTY]]> %vec1, <[[NUM]] x [[STY]]>* noalias dereferenceable({{[0-9]*}}) %vec2) +// CHECK: store <[[NUM]] x [[STY]]> {{%.*}}, <[[NUM]] x [[STY]]>* %vec2, align 4 // CHECK: ret void export void lv_param_in_out(in vector vec1, out vector vec2) { vec2 = vec1; } +// CHECK-LABEL: define void @"\01?lv_param_in_out_rec@@YAXULongVec@@U1@@Z"(%struct.LongVec* %vec1, %struct.LongVec* noalias %vec2) +// CHECK: memcpy +// CHECK: ret void +export void lv_param_in_out_rec(in LongVec vec1, out LongVec vec2) { + vec2 = vec1; +} + +// CHECK-LABEL: define void @"\01?lv_param_in_out_sub@@YAXULongVec@@U1@@Z"(%struct.LongVec* %vec1, %struct.LongVec* noalias %vec2) +// CHECK: memcpy +// CHECK: ret void +export void lv_param_in_out_sub(in LongVec vec1, out LongVec vec2) { + vec2 = vec1; +} + +// CHECK-LABEL: define void @"\01?lv_param_in_out_tpl@@YAXULongVec@@U1@@Z"(%struct.LongVec* %vec1, %struct.LongVec* noalias %vec2) +// CHECK: memcpy +// CHECK: ret void +export void lv_param_in_out_tpl(in LongVec vec1, out LongVec vec2) { + vec2 = vec1; +} + + // CHECK-LABEL: define void @"\01?lv_param_inout -// CHECK-SAME: @@YAXAIAV?$vector@[[MNG]]$06@@0@Z"(<7 x [[STY]]>* noalias dereferenceable({{[0-9]*}}) %vec1, <7 x [[STY]]>* noalias dereferenceable({{[0-9]*}}) %vec2) -// CHECK: load <7 x [[STY]]>, <7 x [[STY]]>* %vec1, align 4 -// CHECK: load <7 x [[STY]]>, <7 x [[STY]]>* %vec2, align 4 -// CHECK: store <7 x [[STY]]> {{%.*}}, <7 x [[STY]]>* %vec1, align 4 -// CHECK: store <7 x [[STY]]> {{%.*}}, <7 x [[STY]]>* %vec2, align 4 +// CHECK-SAME: @@YAXAIAV?$vector@[[MNG]]$[[VS]]@@0@Z"(<[[NUM]] x [[STY]]>* noalias dereferenceable({{[0-9]*}}) %vec1, <[[NUM]] x [[STY]]>* noalias dereferenceable({{[0-9]*}}) %vec2) +// CHECK: load <[[NUM]] x [[STY]]>, <[[NUM]] x [[STY]]>* %vec1, align 4 +// CHECK: load <[[NUM]] x [[STY]]>, <[[NUM]] x [[STY]]>* %vec2, align 4 +// CHECK: store <[[NUM]] x [[STY]]> {{%.*}}, <[[NUM]] x [[STY]]>* %vec1, align 4 +// CHECK: store <[[NUM]] x [[STY]]> {{%.*}}, <[[NUM]] x [[STY]]>* %vec2, align 4 // CHECK: ret void export void lv_param_inout(inout vector vec1, inout vector vec2) { vector tmp = vec1; @@ -66,152 +139,138 @@ export void lv_param_inout(inout vector vec1, inout vector vec2 = tmp; } -// CHECK-LABEL: define void @"\01?lv_param_in_out_rec@@YAXULongVec@@U1@@Z"(%struct.LongVec* %vec1, %struct.LongVec* noalias %vec2) +// CHECK-LABEL: define void @"\01?lv_param_inout_rec@@YAXULongVec@@0@Z"(%struct.LongVec* noalias %vec1, %struct.LongVec* noalias %vec2) // CHECK: memcpy // CHECK: ret void -export void lv_param_in_out_rec(in LongVec vec1, out LongVec vec2) { - vec2 = vec1; +export void lv_param_inout_rec(inout LongVec vec1, inout LongVec vec2) { + LongVec tmp = vec1; + vec1 = vec2; + vec2 = tmp; } -// CHECK-LABEL: define void @"\01?lv_param_inout_rec@@YAXULongVec@@0@Z"(%struct.LongVec* noalias %vec1, %struct.LongVec* noalias %vec2) +// CHECK-LABEL: define void @"\01?lv_param_inout_sub@@YAXULongVec@@0@Z"(%struct.LongVec* noalias %vec1, %struct.LongVec* noalias %vec2) // CHECK: memcpy // CHECK: ret void -export void lv_param_inout_rec(inout LongVec vec1, inout LongVec vec2) { +export void lv_param_inout_sub(inout LongVec vec1, inout LongVec vec2) { LongVec tmp = vec1; vec1 = vec2; vec2 = tmp; } -// CHECK-LABEL: define void @"\01?lv_global_assign -// CHECK-SAME: @@YAXV?$vector@[[MNG]]$06@@@Z"(<7 x [[RTY]]> %vec) -// CHECK: store <7 x [[STY]]> {{%.*}}, <7 x [[STY]]>* @static_vec +// CHECK-LABEL: define void @"\01?lv_param_inout_tpl@@YAXULongVec@@0@Z"(%struct.LongVec* noalias %vec1, %struct.LongVec* noalias %vec2) +// CHECK: memcpy // CHECK: ret void -export void lv_global_assign(vector vec) { - static_vec = vec; +export void lv_param_inout_tpl(inout LongVec vec1, inout LongVec vec2) { + LongVec tmp = vec1; + vec1 = vec2; + vec2 = tmp; } -// CHECK: define <7 x [[RTY]]> -// CHECK-LABEL: @"\01?lv_global_ret -// CHECK-SAME: @@YA?AV?$vector@[[MNG]]$06@@XZ"() -// CHECK: load <7 x [[STY]]>, <7 x [[STY]]>* @static_vec -// CHECK: ret <7 x [[RTY]]> -export vector lv_global_ret() { - vector ret = static_vec; - return ret; +// CHECK-LABEL: define void @"\01?lv_global_assign +// CHECK-SAME: @@YAXV?$vector@[[MNG]]$[[VS]]@@Y09V1@ULongVec@@ULongVecSub@@U?$LongVecTpl@$[[VS]]@@@Z"(<[[NUM]] x [[RTY]]> %vec, [10 x <[[NUM]] x [[STY]]>]* %arr, %struct.LongVec* %rec, %struct.LongVecSub* %sub, %"struct.LongVecTpl<[[NUM]]>"* %tpl) +// CHECK: store <[[NUM]] x [[STY]]> {{%.*}}, <[[NUM]] x [[STY]]>* @static_vec +// CHECK: ret void +export void lv_global_assign(vector vec, vector arr[10], + LongVec rec, LongVecSub sub, LongVecTpl tpl) { + static_vec = vec; + static_vec_arr = arr; + static_vec_rec = rec; + static_vec_sub = sub; + static_vec_tpl = tpl; } // CHECK-LABEL: define void @"\01?lv_gs_assign -// CHECK-SAME: @@YAXV?$vector@[[MNG]]$06@@@Z"(<7 x [[RTY]]> %vec) -// CHECK: store <7 x [[STY]]> {{%.*}}, <7 x [[STY]]> addrspace(3)* @"\01?gs_vec@@3V?$vector@[[MNG]]$06@@A" +// CHECK-SAME: @@YAXV?$vector@[[MNG]]$[[VS]]@@Y09V1@ULongVec@@ULongVecSub@@U?$LongVecTpl@$[[VS]]@@@Z"(<[[NUM]] x [[RTY]]> %vec, [10 x <[[NUM]] x [[STY]]>]* %arr, %struct.LongVec* %rec, %struct.LongVecSub* %sub, %"struct.LongVecTpl<[[NUM]]>"* %tpl) +// CHECK: store <[[NUM]] x [[STY]]> {{%.*}}, <[[NUM]] x [[STY]]> addrspace(3)* @"\01?gs_vec@@3V?$vector@[[MNG]]$[[VS]]@@A" // CHECK: ret void -export void lv_gs_assign(vector vec) { +export void lv_gs_assign(vector vec, vector arr[10], + LongVec rec, LongVecSub sub, LongVecTpl tpl) { gs_vec = vec; + gs_vec_arr = arr; + gs_vec_rec = sub; + gs_vec_tpl = tpl; } -// CHECK: define <7 x [[RTY]]> -// CHECK-LABEL: @"\01?lv_gs_ret -// CHECK-SAME: @@YA?AV?$vector@[[MNG]]$06@@XZ"() -// CHECK: load <7 x [[STY]]>, <7 x [[STY]]> addrspace(3)* @"\01?gs_vec@@3V?$vector@[[MNG]]$06@@A" -// CHECK: ret <7 x [[RTY]]> -export vector lv_gs_ret() { - vector ret = gs_vec; - return ret; -} - -#define DIMS 10 - -// CHECK-LABEL: define void @"\01?lv_param_arr_passthru -// CHECK-SAME: @@YA$$BY09V?$vector@[[MNG]]$06@@V1@@Z"([10 x <7 x [[STY]]>]* noalias sret %agg.result, <7 x [[RTY]]> %vec) -// Arrays are returned in the params -// CHECK: ret void -export vector lv_param_arr_passthru(vector vec)[10] { - vector ret[10]; - for (int i = 0; i < DIMS; i++) - ret[i] = vec; - return ret; -} - -// CHECK-LABEL: define void @"\01?lv_global_arr_assign -// CHECK-SAME: @@YAXY09V?$vector@[[MNG]]$06@@@Z"([10 x <7 x [[STY]]>]* %vec) -// CHECK: ret void -export void lv_global_arr_assign(vector vec[10]) { - for (int i = 0; i < DIMS; i++) - static_vec_arr[i] = vec[i]; +// CHECK: define <[[NUM]] x [[RTY]]> +// CHECK-LABEL: @"\01?lv_global_ret +// CHECK-SAME: @@YA?AV?$vector@[[MNG]]$[[VS]]@@XZ"() +// CHECK: load <[[NUM]] x [[STY]]>, <[[NUM]] x [[STY]]>* @static_vec +// CHECK: ret <[[NUM]] x [[RTY]]> +export vector lv_global_ret() { + return static_vec; } // CHECK-LABEL: define void @"\01?lv_global_arr_ret -// CHECK-SAME: @@YA$$BY09V?$vector@[[MNG]]$06@@XZ"([10 x <7 x [[STY]]>]* noalias sret %agg.result) -// Arrays are returned in the params +// CHECK-SAME: @@YA$$BY09V?$vector@[[MNG]]$[[VS]]@@XZ"([10 x <[[NUM]] x [[STY]]>]* noalias sret %agg.result) // CHECK: ret void export vector lv_global_arr_ret()[10] { - vector ret[10]; - for (int i = 0; i < DIMS; i++) - ret[i] = static_vec_arr[i]; - return ret; -} - -// CHECK-LABEL: define void @"\01?lv_gs_arr_assign -// CHECK-SAME: @@YAXY09V?$vector@[[MNG]]$06@@@Z"([10 x <7 x [[STY]]>]* %vec) -// ret void -export void lv_gs_arr_assign(vector vec[10]) { - for (int i = 0; i < DIMS; i++) - gs_vec_arr[i] = vec[i]; + return static_vec_arr; } -// CHECK-LABEL: define void @"\01?lv_gs_arr_ret -// CHECK-SAME: @@YA$$BY09V?$vector@[[MNG]]$06@@XZ"([10 x <7 x [[STY]]>]* noalias sret %agg.result) -export vector lv_gs_arr_ret()[10] { - vector ret[10]; - for (int i = 0; i < DIMS; i++) - ret[i] = gs_vec_arr[i]; - return ret; +// CHECK-LABEL: define void @"\01?lv_global_rec_ret@@YA?AULongVec@@XZ"(%struct.LongVec* noalias sret %agg.result) +// CHECK: memcpy +// CHECK: ret void +export LongVec lv_global_rec_ret() { + return static_vec_rec; } -// CHECK-LABEL: define void @"\01?lv_param_rec_passthru@@YA?AULongVec@@U1@@Z"(%struct.LongVec* noalias sret %agg.result, %struct.LongVec* %vec) +// CHECK-LABEL: define void @"\01?lv_global_sub_ret@@YA?AULongVecSub@@XZ"(%struct.LongVecSub* noalias sret %agg.result) // CHECK: memcpy -// Aggregates are returned in the params // CHECK: ret void -export LongVec lv_param_rec_passthru(LongVec vec) { - LongVec ret = vec; - return ret; +export LongVecSub lv_global_sub_ret() { + return static_vec_sub; } -// CHECK-LABEL: define void @"\01?lv_global_rec_assign@@YAXULongVec@@@Z"(%struct.LongVec* %vec) +// CHECK-LABEL: define void @"\01?lv_global_tpl_ret +// CHECK-SAME: @@YA?AU?$LongVecTpl@$[[VS]]@@XZ"(%"struct.LongVecTpl<[[NUM]]>"* noalias sret %agg.result) // CHECK: memcpy // CHECK: ret void -export void lv_global_rec_assign(LongVec vec) { - static_vec_rec = vec; +export LongVecTpl lv_global_tpl_ret() { + return static_vec_tpl; } -// CHECK-LABEL: define void @"\01?lv_global_rec_ret@@YA?AULongVec@@XZ"(%struct.LongVec* noalias sret %agg.result) +// CHECK: define <[[NUM]] x [[RTY]]> +// CHECK-LABEL: @"\01?lv_gs_ret +// CHECK-SAME: @@YA?AV?$vector@[[MNG]]$[[VS]]@@XZ"() +// CHECK: load <[[NUM]] x [[STY]]>, <[[NUM]] x [[STY]]> addrspace(3)* @"\01?gs_vec@@3V?$vector@[[MNG]]$[[VS]]@@A" +// CHECK: ret <[[NUM]] x [[RTY]]> +export vector lv_gs_ret() { + return gs_vec; +} + +// CHECK-LABEL: define void @"\01?lv_gs_arr_ret +// CHECK-SAME: @@YA$$BY09V?$vector@[[MNG]]$[[VS]]@@XZ"([10 x <[[NUM]] x [[STY]]>]* noalias sret %agg.result) +// CHECK: ret void +export vector lv_gs_arr_ret()[10] { + return gs_vec_arr; +} + +// CHECK-LABEL: define void @"\01?lv_gs_rec_ret@@YA?AULongVec@@XZ"(%struct.LongVec* noalias sret %agg.result) // CHECK: memcpy -// Aggregates are returned in the params // CHECK: ret void -export LongVec lv_global_rec_ret() { - LongVec ret = static_vec_rec; - return ret; +export LongVec lv_gs_rec_ret() { + return gs_vec_rec; } -// CHECK-LABEL: define void @"\01?lv_gs_rec_assign@@YAXULongVec@@@Z"(%struct.LongVec* %vec) +// CHECK-LABEL: define void @"\01?lv_gs_sub_ret@@YA?AULongVecSub@@XZ"(%struct.LongVecSub* noalias sret %agg.result) // CHECK: memcpy // CHECK: ret void -export void lv_gs_rec_assign(LongVec vec) { - gs_vec_rec = vec; +export LongVecSub lv_gs_sub_ret() { + return gs_vec_sub; } -// CHECK-LABEL: define void @"\01?lv_gs_rec_ret@@YA?AULongVec@@XZ"(%struct.LongVec* noalias sret %agg.result) +// CHECK-LABEL: define void @"\01?lv_gs_tpl_ret +// CHECK-SAME: @@YA?AU?$LongVecTpl@$[[VS]]@@XZ"(%"struct.LongVecTpl<[[NUM]]>"* noalias sret %agg.result) // CHECK: memcpy -// Aggregates are returned in the params // CHECK: ret void -export LongVec lv_gs_rec_ret() { - LongVec ret = gs_vec_rec; - return ret; +export LongVecTpl lv_gs_tpl_ret() { + return gs_vec_tpl; } -// CHECK: define <7 x [[RTY]]> +// CHECK: define <[[NUM]] x [[RTY]]> // CHECK-LABEL: @"\01?lv_splat -// CHECK-SAME: @@YA?AV?$vector@[[MNG]]$06@@[[MNG]]@Z"([[RTY]] {{.*}}%scalar) -// CHECK: ret <7 x [[RTY]]> +// CHECK-SAME: @@YA?AV?$vector@[[MNG]]$[[VS]]@@[[MNG]]@Z"([[RTY]] {{.*}}%scalar) +// CHECK: ret <[[NUM]] x [[RTY]]> export vector lv_splat(TYPE scalar) { vector ret = scalar; return ret; @@ -244,10 +303,10 @@ export vector lv_vec_vec(vector vec1, vector vec2) { return ret; } -// CHECK: define <7 x [[RTY]]> +// CHECK: define <[[NUM]] x [[RTY]]> // CHECK-LABEL: @"\01?lv_array_cast -// CHECK-SAME: @@YA?AV?$vector@[[MNG]]$06@@Y06[[MNG]]@Z"([7 x [[STY]]]* %arr) -// CHECK: ret <7 x [[RTY]]> +// CHECK-SAME: @@YA?AV?$vector@[[MNG]]$[[VS]]@@Y[[VS]][[MNG]]@Z"({{\[}}[[NUM]] x [[STY]]]* %arr) +// CHECK: ret <[[NUM]] x [[RTY]]> export vector lv_array_cast(TYPE arr[NUM]) { vector ret = (vector)arr; return ret; diff --git a/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls.hlsl b/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls.hlsl index ae52983772..98bcc14342 100644 --- a/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls.hlsl +++ b/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls.hlsl @@ -1,86 +1,142 @@ -// RUN: %dxc -DTYPE=float -DNUM=7 -T ps_6_9 -verify %s +// RUN: %dxc -T ps_6_9 -DTYPE=LongVec -DNUM=5 -verify %s +// RUiN: %dxc -T ps_6_9 -DTYPE=LongVecSub -DNUM=128 -verify %s +// RUiN: %dxc -T ps_6_9 -DNUM=1024 -verify %s -struct [raypayload] LongVec { - float4 f : write(closesthit) : read(caller); - vector vec : write(closesthit) : read(caller); -}; +// Add tests for base types and instantiated template classes with longvecs +// Size of the vector shouldn't matter, but using a few different ones just in case. + +#define PASTE_(x,y) x##y +#define PASTE(x,y) PASTE_(x,y) + +#ifndef TYPE +#define TYPE LongVecTpl +#endif -struct LongVecParm { - float f; - float4 tar2 : SV_Target2; - vector vec; +struct LongVec { + float4 f; + vector vec; }; -vector global_vec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} +struct LongVecSub : LongVec { + int3 is; +}; -vector global_vec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} +template +struct LongVecTpl { + float4 f; + vector vec; +}; -LongVec global_vec_rec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} +vector global_vec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} +vector global_vec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} +TYPE global_vec_rec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} +TYPE global_vec_rec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} cbuffer BadBuffy { - vector cb_vec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} - vector cb_vec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} - LongVec cb_vec_rec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} + vector cb_vec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} + vector cb_vec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} + TYPE cb_vec_rec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} + TYPE cb_vec_rec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} }; tbuffer BadTuffy { - vector tb_vec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} - vector tb_vec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} - LongVec tb_vec_rec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} + vector tb_vec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} + vector tb_vec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} + TYPE tb_vec_rec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} + TYPE tb_vec_rec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} }; -ConstantBuffer< LongVec > const_buf; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} -TextureBuffer< LongVec > tex_buf; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} +ConstantBuffer< TYPE > const_buf; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} +TextureBuffer< TYPE > tex_buf; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} + +[shader("pixel")] +vector main( // expected-error{{Vectors of over 4 elements in entry function return type are not supported}} + vector vec : V) : SV_Target { // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} + return vec; +} -vector main( // expected-error{{Vectors of over 4 elements in entry function return type are not supported}} - vector vec : V, // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} - LongVecParm parm : P) : SV_Target { // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} - parm.f = vec; // expected-warning {{implicit truncation of vector type}} - parm.tar2 = vec; // expected-warning {{implicit truncation of vector type}} - return vec; // expected-warning {{implicit truncation of vector type}} +[shader("vertex")] +TYPE vs_main( // expected-error{{Vectors of over 4 elements in entry function return type are not supported}} + TYPE parm : P) : SV_Target { // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} + parm.f = 0; + return parm; } + +[shader("geometry")] +[maxvertexcount(3)] +void gs_point(line TYPE e, // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} + inout PointStream OutputStream0) {} // expected-error{{Vectors of over 4 elements in geometry streams are not supported}} + +[shader("geometry")] +[maxvertexcount(12)] +void gs_line(line TYPE a, // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} + inout LineStream OutputStream0) {} // expected-error{{Vectors of over 4 elements in geometry streams are not supported}} + + +[shader("geometry")] +[maxvertexcount(12)] +void gs_line(line TYPE a, // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} + inout TriangleStream OutputStream0) {} // expected-error{{Vectors of over 4 elements in geometry streams are not supported}} + [shader("domain")] [domain("tri")] -void ds_main(OutputPatch TrianglePatch) {} // expected-error{{Vectors of over 4 elements in tessellation patches are not supported}} - -void PatchConstantFunction(InputPatch inpatch, // expected-error{{Vectors of over 4 elements in tessellation patches are not supported}} - OutputPatch outpatch) {} // expected-error{{Vectors of over 4 elements in tessellation patches are not supported}} +void ds_main(OutputPatch TrianglePatch) {} // expected-error{{Vectors of over 4 elements in tessellation patches are not supported}} +void patch_const(InputPatch inpatch, // expected-error{{Vectors of over 4 elements in tessellation patches are not supported}} + OutputPatch outpatch) {} // expected-error{{Vectors of over 4 elements in tessellation patches are not supported}} [shader("hull")] [domain("tri")] [outputtopology("triangle_cw")] [outputcontrolpoints(32)] -[patchconstantfunc("PatchConstantFunction")] -void hs_main(InputPatch TrianglePatch) {} // expected-error{{Vectors of over 4 elements in tessellation patches are not supported}} +[patchconstantfunc("patch_const")] +void hs_main(InputPatch TrianglePatch) {} // expected-error{{Vectors of over 4 elements in tessellation patches are not supported}} RaytracingAccelerationStructure RTAS; +struct [raypayload] DXRLongVec { + float4 f : write(closesthit) : read(caller); + vector vec : write(closesthit) : read(caller); +}; + +struct [raypayload] DXRLongVecSub : DXRLongVec { + int3 is : write(closesthit) : read(caller); +}; + +template +struct [raypayload] DXRLongVecTpl { + float4 f : write(closesthit) : read(caller); + vector vec : write(closesthit) : read(caller); +}; + +#define RTTYPE PASTE(DXR,TYPE) + [shader("raygeneration")] void raygen() { - LongVec p = (LongVec)0; + RTTYPE p = (RTTYPE)0; RayDesc ray = (RayDesc)0; TraceRay(RTAS, RAY_FLAG_NONE, 0, 0, 1, 0, ray, p); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} CallShader(0, p); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} } + [shader("closesthit")] -void closesthit(inout LongVec payload, // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} - in LongVec attribs ) { // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} +void closesthit(inout RTTYPE payload, // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} + in RTTYPE attribs ) { // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} RayDesc ray; TraceRay( RTAS, RAY_FLAG_NONE, 0xff, 0, 1, 0, ray, payload ); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} CallShader(0, payload); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} } [shader("anyhit")] -void AnyHit( inout LongVec payload, // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} - in LongVec attribs ) // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} +void AnyHit( inout RTTYPE payload, // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} + in RTTYPE attribs ) // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} { } [shader("miss")] -void Miss(inout LongVec payload){ // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} +void Miss(inout RTTYPE payload){ // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} RayDesc ray; TraceRay( RTAS, RAY_FLAG_NONE, 0xff, 0, 1, 0, ray, payload ); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} CallShader(0, payload); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} @@ -89,12 +145,12 @@ void Miss(inout LongVec payload){ // expected-error{{Vectors of over 4 elements [shader("intersection")] void Intersection() { float hitT = RayTCurrent(); - LongVec attr = (LongVec)0; + RTTYPE attr = (RTTYPE)0; bool bReported = ReportHit(hitT, 0, attr); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} } [shader("callable")] -void callable1(inout LongVec p) { // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} +void callable1(inout RTTYPE p) { // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} CallShader(0, p); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} } @@ -106,27 +162,39 @@ void Amp() { DispatchMesh(1,1,1,as_pld); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} } -struct LongVecRec { +struct NodeLongVec { uint3 grid : SV_DispatchGrid; - vector vec; + vector vec; +}; + +struct NodeLongVecSub : NodeLongVec { + int3 is; }; +template +struct NodeLongVecTpl { + uint3 grid : SV_DispatchGrid; + vector vec; +}; + +#define NTYPE PASTE(Node,TYPE) + [Shader("node")] [NodeLaunch("broadcasting")] [NumThreads(8,1,1)] [NodeMaxDispatchGrid(8,1,1)] -void broadcast(DispatchNodeInputRecord input, // expected-error{{Vectors of over 4 elements in node records are not supported}} - NodeOutput output) // expected-error{{Vectors of over 4 elements in node records are not supported}} +void broadcast(DispatchNodeInputRecord input, // expected-error{{Vectors of over 4 elements in node records are not supported}} + NodeOutput output) // expected-error{{Vectors of over 4 elements in node records are not supported}} { - ThreadNodeOutputRecords touts; // expected-error{{Vectors of over 4 elements in node records are not supported}} - GroupNodeOutputRecords gouts; // expected-error{{Vectors of over 4 elements in node records are not supported}} + ThreadNodeOutputRecords touts; // expected-error{{Vectors of over 4 elements in node records are not supported}} + GroupNodeOutputRecords gouts; // expected-error{{Vectors of over 4 elements in node records are not supported}} } [Shader("node")] [NodeLaunch("coalescing")] [NumThreads(8,1,1)] -void coalesce(GroupNodeInputRecords input) {} // expected-error{{Vectors of over 4 elements in node records are not supported}} +void coalesce(GroupNodeInputRecords input) {} // expected-error{{Vectors of over 4 elements in node records are not supported}} [Shader("node")] [NodeLaunch("thread")] -void threader(ThreadNodeInputRecord input) {} // expected-error{{Vectors of over 4 elements in node records are not supported}} +void threader(ThreadNodeInputRecord input) {} // expected-error{{Vectors of over 4 elements in node records are not supported}} diff --git a/tools/clang/test/SemaHLSL/hlsl/types/toolong-vectors.hlsl b/tools/clang/test/SemaHLSL/hlsl/types/toolong-vectors.hlsl new file mode 100644 index 0000000000..c1da348695 --- /dev/null +++ b/tools/clang/test/SemaHLSL/hlsl/types/toolong-vectors.hlsl @@ -0,0 +1,116 @@ +// RUN: %dxc -T lib_6_9 -DTYPE=float -DNUM=1025 -verify %s +// RUN: %dxc -T ps_6_9 -DTYPE=float -DNUM=1025 -verify %s + +// A test to verify that declarations of longvecs are permitted in all the accepted places. +// Only tests for acceptance, most codegen is ignored for now. + +struct LongVec { + float4 f; + vector vec; // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} +}; + +template +struct LongVecTpl { + float4 f; + vector vec; // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} +}; + +template +struct LongVecTpl2 { + float4 f; + vector vec; // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} +}; + +groupshared vector gs_vec; // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} +groupshared vector gs_vec_arr[10]; // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} +groupshared LongVecTpl gs_vec_tpl; // expected-note{{in instantiation of template class 'LongVecTpl<1025>' requested here}} + +static vector static_vec; // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} +static vector static_vec_arr[10]; // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} +static LongVecTpl2 static_vec_tpl; // expected-note{{in instantiation of template class 'LongVecTpl2<1025>' requested here}} + +export vector // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} +lv_param_passthru(vector vec1) { // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + vector ret = vec1; // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + return ret; +} + +export void lv_param_in_out(in vector vec1, // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + out vector vec2) { // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + vec2 = vec1; +} + +export void lv_param_inout(inout vector vec1, // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + inout vector vec2) { // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + vector tmp = vec1; // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + vec1 = vec2; + vec2 = tmp; +} + +export void lv_global_assign(vector vec) { // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + static_vec = vec; +} + +export vector lv_global_ret() { // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + vector ret = static_vec; // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + return ret; +} + +export void lv_gs_assign(vector vec) { // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + gs_vec = vec; +} + +export vector lv_gs_ret() { // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + vector ret = gs_vec; // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + return ret; +} + +#define DIMS 10 + +export vector // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} +lv_param_arr_passthru(vector vec)[10] { // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + vector ret[10]; // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + for (int i = 0; i < DIMS; i++) + ret[i] = vec; + return ret; +} + +export void lv_global_arr_assign(vector vec[10]) { // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + for (int i = 0; i < DIMS; i++) + static_vec_arr[i] = vec[i]; +} + +export vector lv_global_arr_ret()[10] { // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + vector ret[10]; // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + for (int i = 0; i < DIMS; i++) + ret[i] = static_vec_arr[i]; + return ret; +} + +export void lv_gs_arr_assign(vector vec[10]) { // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + for (int i = 0; i < DIMS; i++) + gs_vec_arr[i] = vec[i]; +} + +export vector lv_gs_arr_ret()[10] { // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + vector ret[10]; // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + for (int i = 0; i < DIMS; i++) + ret[i] = gs_vec_arr[i]; + return ret; +} + +export LongVec lv_param_rec_passthru(LongVec vec) { + LongVec ret = vec; + return ret; +} + +export vector lv_splat(TYPE scalar) { // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + vector ret = scalar; // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + return ret; +} + +export vector lv_array_cast(TYPE arr[NUM]) { // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + vector ret = (vector)arr; // expected-error{{invalid value, valid range is between 1 and 1024 inclusive}} + return ret; +} + From fb6538e844a2993de10100c77769cbf0f2e862d2 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Mon, 3 Mar 2025 13:00:18 -0700 Subject: [PATCH 08/45] clang-format --- tools/clang/include/clang/AST/HlslTypes.h | 11 +++++----- tools/clang/lib/AST/ASTContextHLSL.cpp | 9 ++++---- tools/clang/lib/AST/HlslTypes.cpp | 4 +--- tools/clang/lib/Sema/SemaHLSL.cpp | 25 ++++++++++++----------- 4 files changed, 24 insertions(+), 25 deletions(-) diff --git a/tools/clang/include/clang/AST/HlslTypes.h b/tools/clang/include/clang/AST/HlslTypes.h index 9aeb97d3ee..5cd14cbe8a 100644 --- a/tools/clang/include/clang/AST/HlslTypes.h +++ b/tools/clang/include/clang/AST/HlslTypes.h @@ -348,10 +348,10 @@ void AddHLSLNodeOutputRecordTemplate( _Outptr_ clang::ClassTemplateDecl **outputRecordTemplateDecl, bool isCompleteType = true); -clang::CXXRecordDecl *DeclareRecordTypeWithHandle(clang::ASTContext &context, - llvm::StringRef name, - bool isCompleteType = true, - clang::InheritableAttr *Attr = nullptr); +clang::CXXRecordDecl * +DeclareRecordTypeWithHandle(clang::ASTContext &context, llvm::StringRef name, + bool isCompleteType = true, + clang::InheritableAttr *Attr = nullptr); void AddRaytracingConstants(clang::ASTContext &context); void AddSamplerFeedbackConstants(clang::ASTContext &context); @@ -382,8 +382,7 @@ clang::CXXRecordDecl *DeclareTemplateTypeWithHandleInDeclContext( clang::CXXRecordDecl *DeclareUIntTemplatedTypeWithHandle( clang::ASTContext &context, llvm::StringRef typeName, - llvm::StringRef templateParamName, - clang::InheritableAttr *Attr = nullptr); + llvm::StringRef templateParamName, clang::InheritableAttr *Attr = nullptr); clang::CXXRecordDecl *DeclareUIntTemplatedTypeWithHandleInDeclContext( clang::ASTContext &context, clang::DeclContext *declContext, llvm::StringRef typeName, llvm::StringRef templateParamName, diff --git a/tools/clang/lib/AST/ASTContextHLSL.cpp b/tools/clang/lib/AST/ASTContextHLSL.cpp index e71f37b663..5b10540e7a 100644 --- a/tools/clang/lib/AST/ASTContextHLSL.cpp +++ b/tools/clang/lib/AST/ASTContextHLSL.cpp @@ -1111,7 +1111,8 @@ CXXRecordDecl *hlsl::DeclareUIntTemplatedTypeWithHandleInDeclContext( ASTContext &context, DeclContext *declContext, StringRef typeName, StringRef templateParamName, InheritableAttr *Attr) { // template FeedbackTexture2D[Array] { ... } - BuiltinTypeDeclBuilder typeDeclBuilder(declContext, typeName, TagTypeKind::TTK_Class); + BuiltinTypeDeclBuilder typeDeclBuilder(declContext, typeName, + TagTypeKind::TTK_Class); typeDeclBuilder.addIntegerTemplateParam(templateParamName, context.UnsignedIntTy); typeDeclBuilder.startDefinition(); @@ -1140,9 +1141,9 @@ hlsl::DeclareConstantBufferViewType(clang::ASTContext &context, bool bTBuf) { typeDeclBuilder.addField( "h", context.UnsignedIntTy); // Add an 'h' field to hold the handle. - typeDeclBuilder.getRecordDecl()->addAttr( - HLSLResourceAttr::CreateImplicit(context, (unsigned)DXIL::ResourceKind::CBuffer, - (unsigned)DXIL::ResourceClass::CBuffer)); + typeDeclBuilder.getRecordDecl()->addAttr(HLSLResourceAttr::CreateImplicit( + context, (unsigned)DXIL::ResourceKind::CBuffer, + (unsigned)DXIL::ResourceClass::CBuffer)); typeDeclBuilder.getRecordDecl(); diff --git a/tools/clang/lib/AST/HlslTypes.cpp b/tools/clang/lib/AST/HlslTypes.cpp index 5f7e93fbee..4dd44c02d7 100644 --- a/tools/clang/lib/AST/HlslTypes.cpp +++ b/tools/clang/lib/AST/HlslTypes.cpp @@ -475,9 +475,7 @@ clang::QualType GetHLSLMatElementType(clang::QualType type) { return elemTy; } - -template -static AttrType *getAttr(clang::QualType type) { +template static AttrType *getAttr(clang::QualType type) { type = type.getCanonicalType(); if (const RecordType *RT = type->getAs()) { if (const auto *Spec = diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index fe3390a89e..ff0624045f 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -363,7 +363,7 @@ enum ArBasicKind { #define IS_BPROP_STREAM(_Props) (((_Props)&BPROP_STREAM) != 0) -#define IS_BPROP_PATCH(_Props) (((_Props) & BPROP_PATCH) != 0) +#define IS_BPROP_PATCH(_Props) (((_Props)&BPROP_PATCH) != 0) #define IS_BPROP_SAMPLER(_Props) (((_Props)&BPROP_SAMPLER) != 0) @@ -3546,11 +3546,11 @@ class HLSLExternalSource : public ExternalSemaSource { InheritableAttr *Attr = nullptr; if (IS_BASIC_STREAM(kind)) - Attr = - HLSLStreamOutputAttr::CreateImplicit(*m_context, - kind - AR_OBJECT_POINTSTREAM + 1); + Attr = HLSLStreamOutputAttr::CreateImplicit( + *m_context, kind - AR_OBJECT_POINTSTREAM + 1); else if (IS_BASIC_PATCH(kind)) - Attr = HLSLTessPatchAttr::CreateImplicit(*m_context, kind == AR_OBJECT_INPUTPATCH); + Attr = HLSLTessPatchAttr::CreateImplicit(*m_context, + kind == AR_OBJECT_INPUTPATCH); else { DXIL::ResourceKind ResKind = DXIL::ResourceKind::NumEntries; DXIL::ResourceClass ResClass = DXIL::ResourceClass::Invalid; @@ -3746,9 +3746,9 @@ class HLSLExternalSource : public ExternalSemaSource { } #endif else if (templateArgCount == 0) { - recordDecl = DeclareRecordTypeWithHandle(*m_context, typeName, - /*isCompleteType*/ false, - Attr); + recordDecl = + DeclareRecordTypeWithHandle(*m_context, typeName, + /*isCompleteType*/ false, Attr); } else { DXASSERT(templateArgCount == 1 || templateArgCount == 2, "otherwise a new case has been added"); @@ -5237,8 +5237,9 @@ class HLSLExternalSource : public ExternalSemaSource { } // Allow object type for Constant/TextureBuffer. HLSLResourceAttr *ResAttr = - Template->getTemplatedDecl()->getAttr(); - if (ResAttr && ResAttr->getResClass() == (unsigned)DXIL::ResourceClass::CBuffer) { + Template->getTemplatedDecl()->getAttr(); + if (ResAttr && + ResAttr->getResClass() == (unsigned)DXIL::ResourceClass::CBuffer) { if (TemplateArgList.size() == 1) { const TemplateArgumentLoc &argLoc = TemplateArgList[0]; const TemplateArgument &arg = argLoc.getArgument(); @@ -5353,7 +5354,7 @@ class HLSLExternalSource : public ExternalSemaSource { if (ContainsVectorLongerThan(argType, DXIL::kDefaultMaxVectorLength)) { m_sema->Diag(argLoc.getLocation(), diag::err_hlsl_unsupported_long_vector) - << DXIL::kDefaultMaxVectorLength << "tessellation patches"; + << DXIL::kDefaultMaxVectorLength << "tessellation patches"; return true; } } else if (Template->getTemplatedDecl()->hasAttr()) { @@ -5367,7 +5368,7 @@ class HLSLExternalSource : public ExternalSemaSource { if (ContainsVectorLongerThan(argType, DXIL::kDefaultMaxVectorLength)) { m_sema->Diag(argLoc.getLocation(), diag::err_hlsl_unsupported_long_vector) - << DXIL::kDefaultMaxVectorLength << "geometry streams"; + << DXIL::kDefaultMaxVectorLength << "geometry streams"; return true; } } From 19633b2b0ec8187cda5a4163c577a9dcec6e29d6 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Tue, 25 Feb 2025 14:43:14 -0700 Subject: [PATCH 09/45] Handle subclasses and templates of longvector structs Use RequireCompleteType to force specialization of templates encountered in global and other scopes where finding long vectors is necessary where possible. This populates the definitiondata which contains the base class chain needed to detect when a base class has disqualifying long vectors. It was also needed to detect when dependent types in a template class result in long vectors. Work graph node types didn't check their base classes for failures. This affects base classes with longvectors that have sub classes used for node objects which should fail for having long vector members. Respond to feedback about iterating through fields in clunky manner which got left out of the last reviewer feedback response --- tools/clang/include/clang/Sema/SemaHLSL.h | 3 +- tools/clang/lib/Sema/SemaDXR.cpp | 2 +- tools/clang/lib/Sema/SemaHLSL.cpp | 78 ++++++++++--------- tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp | 5 +- .../hlsl/types/invalid-longvec-decls.hlsl | 4 +- 5 files changed, 50 insertions(+), 42 deletions(-) diff --git a/tools/clang/include/clang/Sema/SemaHLSL.h b/tools/clang/include/clang/Sema/SemaHLSL.h index 786f82933d..d31e32acbb 100644 --- a/tools/clang/include/clang/Sema/SemaHLSL.h +++ b/tools/clang/include/clang/Sema/SemaHLSL.h @@ -128,7 +128,8 @@ unsigned CaculateInitListArraySizeForHLSL(clang::Sema *sema, const clang::InitListExpr *InitList, const clang::QualType EltTy); -bool ContainsVectorLongerThan(const clang::QualType &qt, unsigned length); +bool ContainsVectorLongerThan(clang::Sema *S, clang::QualType qt, + unsigned length); bool IsConversionToLessOrEqualElements(clang::Sema *self, const clang::ExprResult &sourceExpr, diff --git a/tools/clang/lib/Sema/SemaDXR.cpp b/tools/clang/lib/Sema/SemaDXR.cpp index 07234554e2..32ca88c27a 100644 --- a/tools/clang/lib/Sema/SemaDXR.cpp +++ b/tools/clang/lib/Sema/SemaDXR.cpp @@ -810,7 +810,7 @@ void DiagnoseTraceCall(Sema &S, const VarDecl *Payload, return; } - if (hlsl::ContainsVectorLongerThan(Payload->getType(), + if (hlsl::ContainsVectorLongerThan(&S, Payload->getType(), DXIL::kDefaultMaxVectorLength)) { S.Diag(Payload->getLocation(), diag::err_hlsl_unsupported_long_vector) << DXIL::kDefaultMaxVectorLength << "payload parameters"; diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index ff0624045f..ac5ab27835 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -5254,23 +5254,13 @@ class HLSLExternalSource : public ExternalSemaSource { << argType; return true; } - if (ContainsVectorLongerThan(argType, DXIL::kDefaultMaxVectorLength)) { + if (ContainsVectorLongerThan(m_sema, argType, + DXIL::kDefaultMaxVectorLength)) { m_sema->Diag(argSrcLoc, diag::err_hlsl_unsupported_long_vector) << DXIL::kDefaultMaxVectorLength << "cbuffers"; return true; } - if (auto *TST = dyn_cast(argType)) { - // This is a bit of a special case we need to handle. Because the - // buffer types don't use their template parameter in a way that would - // force instantiation, we need to force specialization here. - GetOrCreateTemplateSpecialization( - *m_context, *m_sema, - cast( - TST->getTemplateName().getAsTemplateDecl()), - llvm::ArrayRef(TST->getArgs(), - TST->getNumArgs())); - } if (const RecordType *recordType = argType->getAs()) { if (!recordType->getDecl()->isCompleteDefinition()) { m_sema->Diag(argSrcLoc, diag::err_typecheck_decl_incomplete_type) @@ -5351,7 +5341,8 @@ class HLSLExternalSource : public ExternalSemaSource { DXASSERT(arg.getKind() == TemplateArgument::ArgKind::Type, "Tessellation patch requires type template arg 0"); QualType argType = arg.getAsType(); - if (ContainsVectorLongerThan(argType, DXIL::kDefaultMaxVectorLength)) { + if (ContainsVectorLongerThan(m_sema, argType, + DXIL::kDefaultMaxVectorLength)) { m_sema->Diag(argLoc.getLocation(), diag::err_hlsl_unsupported_long_vector) << DXIL::kDefaultMaxVectorLength << "tessellation patches"; @@ -5365,7 +5356,8 @@ class HLSLExternalSource : public ExternalSemaSource { DXASSERT(arg.getKind() == TemplateArgument::ArgKind::Type, "Geometry stream requires type template arg 0"); QualType argType = arg.getAsType(); - if (ContainsVectorLongerThan(argType, DXIL::kDefaultMaxVectorLength)) { + if (ContainsVectorLongerThan(m_sema, argType, + DXIL::kDefaultMaxVectorLength)) { m_sema->Diag(argLoc.getLocation(), diag::err_hlsl_unsupported_long_vector) << DXIL::kDefaultMaxVectorLength << "geometry streams"; @@ -11662,14 +11654,15 @@ bool hlsl::DiagnoseNodeStructArgument(Sema *self, TemplateArgumentLoc ArgLoc, bool ErrorFound = false; const RecordDecl *RD = ArgTy->getAs()->getDecl(); // Check the fields of the RecordDecl - RecordDecl::field_iterator begin = RD->field_begin(); - RecordDecl::field_iterator end = RD->field_end(); - while (begin != end) { - const FieldDecl *FD = *begin; + for (auto *FD : RD->fields()) ErrorFound |= DiagnoseNodeStructArgument(self, ArgLoc, FD->getType(), Empty, FD); - begin++; - } + if (RD->isCompleteDefinition()) + if (auto *Child = dyn_cast(RD)) + // Walk up the inheritance chain and check base class fields + for (auto &B : Child->bases()) + ErrorFound |= + DiagnoseNodeStructArgument(self, ArgLoc, B.getType(), Empty); return ErrorFound; } default: @@ -12105,8 +12098,8 @@ bool hlsl::ShouldSkipNRVO(clang::Sema &sema, clang::QualType returnType, return false; } -bool hlsl::ContainsVectorLongerThan(const QualType &qt, unsigned length) { - if (qt.isNull()) +bool hlsl::ContainsVectorLongerThan(Sema *S, QualType qt, unsigned length) { + if (qt.isNull() || qt->isDependentType()) return false; if (IsHLSLVecType(qt)) { @@ -12114,19 +12107,30 @@ bool hlsl::ContainsVectorLongerThan(const QualType &qt, unsigned length) { return true; } else if (qt->isArrayType()) { const ArrayType *arrayType = qt->getAsArrayTypeUnsafe(); - return ContainsVectorLongerThan(arrayType->getElementType(), length); + return ContainsVectorLongerThan(S, arrayType->getElementType(), length); } else if (qt->isStructureOrClassType()) { const RecordType *recordType = qt->getAs(); - const RecordDecl *recordDecl = recordType->getDecl(); + RecordDecl *recordDecl = recordType->getDecl(); if (recordDecl->isInvalidDecl()) return false; - RecordDecl::field_iterator begin = recordDecl->field_begin(); - RecordDecl::field_iterator end = recordDecl->field_end(); - for (; begin != end; begin++) { - const FieldDecl *fieldDecl = *begin; - if (ContainsVectorLongerThan(fieldDecl->getType(), length)) - return true; + if (ClassTemplateSpecializationDecl *templateSpecializationDecl = + dyn_cast(recordDecl)) { + if (templateSpecializationDecl->getSpecializationKind() == + TSK_Undeclared) { + S->RequireCompleteType(recordDecl->getLocation(), qt, + diag::err_typecheck_decl_incomplete_type); + } } + if (!recordDecl->isCompleteDefinition()) + return false; + for (FieldDecl *FD : recordDecl->fields()) + if (ContainsVectorLongerThan(S, FD->getType(), length)) + return true; + if (auto *Child = dyn_cast(recordDecl)) + // Walk up the inheritance chain and check all fields on base classes + for (auto &B : Child->bases()) + if (ContainsVectorLongerThan(S, B.getType(), length)) + return true; } return false; } @@ -14759,9 +14763,9 @@ bool Sema::DiagnoseHLSLDecl(Declarator &D, DeclContext *DC, Expr *BitWidth, result = false; } - // Disallow long vecs from cbuffers. + // Disallow long vecs from $Global cbuffers. if (isGlobal && !isStatic && !isGroupShared && - ContainsVectorLongerThan(qt, DXIL::kDefaultMaxVectorLength)) { + ContainsVectorLongerThan(this, qt, DXIL::kDefaultMaxVectorLength)) { Diag(D.getLocStart(), diag::err_hlsl_unsupported_long_vector) << DXIL::kDefaultMaxVectorLength << "cbuffers"; result = false; @@ -15657,7 +15661,8 @@ static bool isRelatedDeclMarkedNointerpolation(Expr *E) { // Verify that user-defined intrinsic struct args contain no long vectors static bool CheckUDTIntrinsicArg(Sema *S, Expr *Arg) { - if (ContainsVectorLongerThan(Arg->getType(), DXIL::kDefaultMaxVectorLength)) { + if (ContainsVectorLongerThan(S, Arg->getType(), + DXIL::kDefaultMaxVectorLength)) { S->Diag(Arg->getExprLoc(), diag::err_hlsl_unsupported_long_vector) << DXIL::kDefaultMaxVectorLength << "user-defined struct parameter"; return true; @@ -16397,13 +16402,14 @@ void DiagnoseEntry(Sema &S, FunctionDecl *FD) { // Check general parameter characteristics // Would be nice to check for resources here as they crash the compiler now. - for (const auto *param : FD->params()) - if (ContainsVectorLongerThan(param->getType(), + for (const auto *param : FD->params()) { + if (ContainsVectorLongerThan(&S, param->getType(), DXIL::kDefaultMaxVectorLength)) S.Diag(param->getLocation(), diag::err_hlsl_unsupported_long_vector) << DXIL::kDefaultMaxVectorLength << "entry function parameters"; + } - if (ContainsVectorLongerThan(FD->getReturnType(), + if (ContainsVectorLongerThan(&S, FD->getReturnType(), DXIL::kDefaultMaxVectorLength)) S.Diag(FD->getLocation(), diag::err_hlsl_unsupported_long_vector) << DXIL::kDefaultMaxVectorLength << "entry function return type"; diff --git a/tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp b/tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp index adb2352a56..6645c4c3d2 100644 --- a/tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp +++ b/tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp @@ -521,14 +521,15 @@ void hlsl::DiagnoseTranslationUnit(clang::Sema *self) { } } for (const auto *param : pPatchFnDecl->params()) - if (ContainsVectorLongerThan(param->getType(), + if (ContainsVectorLongerThan(self, param->getType(), DXIL::kDefaultMaxVectorLength)) self->Diag(param->getLocation(), diag::err_hlsl_unsupported_long_vector) << DXIL::kDefaultMaxVectorLength << "patch constant function parameters"; - if (ContainsVectorLongerThan(pPatchFnDecl->getReturnType(), 4)) + if (ContainsVectorLongerThan(self, pPatchFnDecl->getReturnType(), + DXIL::kDefaultMaxVectorLength)) self->Diag(pPatchFnDecl->getLocation(), diag::err_hlsl_unsupported_long_vector) << DXIL::kDefaultMaxVectorLength diff --git a/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls.hlsl b/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls.hlsl index 98bcc14342..2d0f800121 100644 --- a/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls.hlsl +++ b/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls.hlsl @@ -1,6 +1,6 @@ // RUN: %dxc -T ps_6_9 -DTYPE=LongVec -DNUM=5 -verify %s -// RUiN: %dxc -T ps_6_9 -DTYPE=LongVecSub -DNUM=128 -verify %s -// RUiN: %dxc -T ps_6_9 -DNUM=1024 -verify %s +// RUN: %dxc -T ps_6_9 -DTYPE=LongVecSub -DNUM=128 -verify %s +// RUN: %dxc -T ps_6_9 -DNUM=1024 -verify %s // Add tests for base types and instantiated template classes with longvecs // Size of the vector shouldn't matter, but using a few different ones just in case. From 466bb1498f9edd8ea7c8e265185ae6c679aee288 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 5 Mar 2025 20:50:11 +0000 Subject: [PATCH 10/45] chore: autopublish 2025-03-05T20:50:11Z --- tools/clang/lib/Sema/SemaHLSL.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index ac5ab27835..9b1537d03a 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -363,7 +363,7 @@ enum ArBasicKind { #define IS_BPROP_STREAM(_Props) (((_Props)&BPROP_STREAM) != 0) -#define IS_BPROP_PATCH(_Props) (((_Props)&BPROP_PATCH) != 0) +#define IS_BPROP_PATCH(_Props) (((_Props) & BPROP_PATCH) != 0) #define IS_BPROP_SAMPLER(_Props) (((_Props)&BPROP_SAMPLER) != 0) From 66bb77262fff4f660b065da8dd30fc3f342d4880 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Wed, 5 Mar 2025 19:11:54 -0700 Subject: [PATCH 11/45] Identify matrices and vectors by attributes I guess it was about time. Should simplify some things later as well as at present and it was too easy to not do. Specifically, I was going to need to add another string check to the template instantiation code to identify longvectors. This is cleaner. Incidentally convert another feedback texture string check to use attribs. Incidentally resort the recently-added attribs to not break up the node shader attribs. --- tools/clang/include/clang/Basic/Attr.td | 55 ++++++++------ tools/clang/lib/AST/ASTContextHLSL.cpp | 6 ++ tools/clang/lib/AST/HlslTypes.cpp | 76 ++++++++----------- .../hlsl/types/matrix/matrix-ast.hlsl | 1 + .../hlsl/types/vector/vector-ast.hlsl | 1 + 5 files changed, 74 insertions(+), 65 deletions(-) diff --git a/tools/clang/include/clang/Basic/Attr.td b/tools/clang/include/clang/Basic/Attr.td index e344e7b851..29430e6d4c 100644 --- a/tools/clang/include/clang/Basic/Attr.td +++ b/tools/clang/include/clang/Basic/Attr.td @@ -939,6 +939,39 @@ def HLSLCXXOverload : InheritableAttr { let Documentation = [Undocumented]; } +def HLSLVector : InheritableAttr { + let Spellings = []; // No spellings! + let Subjects = SubjectList<[CXXRecord]>; + let Documentation = [Undocumented]; +} + +def HLSLMatrix : InheritableAttr { + let Spellings = []; // No spellings! + let Subjects = SubjectList<[CXXRecord]>; + let Documentation = [Undocumented]; +} + +def HLSLTessPatch : InheritableAttr { + let Spellings = []; // No spellings! + let Args = [BoolArgument<"IsInput">]; + let Subjects = SubjectList<[CXXRecord]>; + let Documentation = [Undocumented]; +} + +def HLSLStreamOutput : InheritableAttr { + let Spellings = []; // No spellings! + let Args = [UnsignedArgument<"Vertices">]; + let Subjects = SubjectList<[CXXRecord]>; + let Documentation = [Undocumented]; +} + +def HLSLResource : InheritableAttr { + let Spellings = []; // No spellings! + let Args = [UnsignedArgument<"ResKind">, UnsignedArgument<"ResClass">]; + let Subjects = SubjectList<[CXXRecord]>; + let Documentation = [Undocumented]; +} + def HLSLNodeLaunch : InheritableAttr { let Spellings = [CXX11<"", "nodelaunch", 2017>]; let Args = [StringArgument<"LaunchType">]; // one of broadcasting, coalescing, thread @@ -992,28 +1025,6 @@ def HLSLNodeTrackRWInputSharing : InheritableAttr { let Documentation = [Undocumented]; } - -def HLSLTessPatch : InheritableAttr { - let Spellings = []; // No spellings! - let Args = [BoolArgument<"IsInput">]; - let Subjects = SubjectList<[CXXRecord]>; - let Documentation = [Undocumented]; -} - -def HLSLStreamOutput : InheritableAttr { - let Spellings = []; // No spellings! - let Args = [UnsignedArgument<"Vertices">]; - let Subjects = SubjectList<[CXXRecord]>; - let Documentation = [Undocumented]; -} - -def HLSLResource : InheritableAttr { - let Spellings = []; // No spellings! - let Args = [UnsignedArgument<"ResKind">, UnsignedArgument<"ResClass">]; - let Subjects = SubjectList<[CXXRecord]>; - let Documentation = [Undocumented]; -} - def HLSLNodeObject : InheritableAttr { let Spellings = []; // No spellings! let Subjects = SubjectList<[CXXRecord]>; diff --git a/tools/clang/lib/AST/ASTContextHLSL.cpp b/tools/clang/lib/AST/ASTContextHLSL.cpp index 5b10540e7a..9bacfc8b42 100644 --- a/tools/clang/lib/AST/ASTContextHLSL.cpp +++ b/tools/clang/lib/AST/ASTContextHLSL.cpp @@ -329,6 +329,9 @@ void hlsl::AddHLSLMatrixTemplate(ASTContext &context, typeDeclBuilder.addField("h", vectorArrayType); + typeDeclBuilder.getRecordDecl()->addAttr( + HLSLMatrixAttr::CreateImplicit(context)); + // Add an operator[]. The operator ranges from zero to rowcount-1, and returns // a vector of colcount elements. const unsigned int templateDepth = 0; @@ -385,6 +388,9 @@ void hlsl::AddHLSLVectorTemplate(ASTContext &context, // Add an 'h' field to hold the handle. typeDeclBuilder.addField("h", vectorType); + typeDeclBuilder.getRecordDecl()->addAttr( + HLSLVectorAttr::CreateImplicit(context)); + // Add an operator[]. The operator ranges from zero to colcount-1, and returns // a scalar. diff --git a/tools/clang/lib/AST/HlslTypes.cpp b/tools/clang/lib/AST/HlslTypes.cpp index 4dd44c02d7..e9c443b9d7 100644 --- a/tools/clang/lib/AST/HlslTypes.cpp +++ b/tools/clang/lib/AST/HlslTypes.cpp @@ -53,44 +53,44 @@ ConvertHLSLVecMatTypeToExtVectorType(const clang::ASTContext &context, return nullptr; } +template static AttrType *getAttr(clang::QualType type) { + type = type.getCanonicalType(); + if (const RecordType *RT = type->getAs()) { + if (const auto *Spec = + dyn_cast(RT->getDecl())) + if (const auto *Template = + dyn_cast(Spec->getSpecializedTemplate())) + return Template->getTemplatedDecl()->getAttr(); + if (const auto *Decl = dyn_cast(RT->getDecl())) + return Decl->getAttr(); + } + return nullptr; +} + bool IsHLSLVecMatType(clang::QualType type) { - const Type *Ty = type.getCanonicalType().getTypePtr(); - if (const RecordType *RT = dyn_cast(Ty)) { - if (const ClassTemplateSpecializationDecl *templateDecl = - dyn_cast(RT->getDecl())) { - if (templateDecl->getName() == "vector") { - return true; - } else if (templateDecl->getName() == "matrix") { - return true; - } - } + type = type.getCanonicalType(); + if (const RecordType *RT = type->getAs()) { + if (const auto *Spec = + dyn_cast(RT->getDecl())) + if (const auto *Template = + dyn_cast(Spec->getSpecializedTemplate())) + return Template->getTemplatedDecl()->getAttr() || + Template->getTemplatedDecl()->getAttr(); + if (const auto *Decl = dyn_cast(RT->getDecl())) + return Decl->getAttr() || Decl->getAttr(); } return false; } bool IsHLSLMatType(clang::QualType type) { - const clang::Type *Ty = type.getCanonicalType().getTypePtr(); - if (const RecordType *RT = dyn_cast(Ty)) { - if (const ClassTemplateSpecializationDecl *templateDecl = - dyn_cast(RT->getDecl())) { - if (templateDecl->getName() == "matrix") { - return true; - } - } - } + if (getAttr(type)) + return true; return false; } bool IsHLSLVecType(clang::QualType type) { - const clang::Type *Ty = type.getCanonicalType().getTypePtr(); - if (const RecordType *RT = dyn_cast(Ty)) { - if (const ClassTemplateSpecializationDecl *templateDecl = - dyn_cast(RT->getDecl())) { - if (templateDecl->getName() == "vector") { - return true; - } - } - } + if (getAttr(type)) + return true; return false; } @@ -475,20 +475,6 @@ clang::QualType GetHLSLMatElementType(clang::QualType type) { return elemTy; } -template static AttrType *getAttr(clang::QualType type) { - type = type.getCanonicalType(); - if (const RecordType *RT = type->getAs()) { - if (const auto *Spec = - dyn_cast(RT->getDecl())) - if (const auto *Template = - dyn_cast(Spec->getSpecializedTemplate())) - return Template->getTemplatedDecl()->getAttr(); - if (const auto *Decl = dyn_cast(RT->getDecl())) - return Decl->getAttr(); - } - return nullptr; -} - // TODO: Add type cache to ASTContext. bool IsHLSLInputPatchType(QualType type) { type = type.getCanonicalType(); @@ -812,7 +798,11 @@ QualType GetHLSLResourceResultType(QualType type) { if (const ClassTemplateSpecializationDecl *templateDecl = dyn_cast(RD)) { - if (RD->getName().startswith("FeedbackTexture")) { + const HLSLResourceAttr *Attr = getAttr(type); + if (Attr && (Attr->getResKind() == + (unsigned)DXIL::ResourceKind::FeedbackTexture2D || + Attr->getResKind() == + (unsigned)DXIL::ResourceKind::FeedbackTexture2DArray)) { // Feedback textures are write-only and the data is opaque, // so there is no result type per se. return {}; diff --git a/tools/clang/test/HLSLFileCheck/hlsl/types/matrix/matrix-ast.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/types/matrix/matrix-ast.hlsl index 33086852ab..5443ada0c9 100644 --- a/tools/clang/test/HLSLFileCheck/hlsl/types/matrix/matrix-ast.hlsl +++ b/tools/clang/test/HLSLFileCheck/hlsl/types/matrix/matrix-ast.hlsl @@ -15,6 +15,7 @@ // ext_vector array. // CHECK-NEXT: CXXRecordDecl {{0x[0-9a-fA-F]+}} <> implicit class matrix definition // CHECK-NEXT: FinalAttr {{0x[0-9a-fA-F]+}} <> Implicit final +// CHECK-NEXT: HLSLMatrixAttr {{0x[0-9a-fA-F]+}} <> Implicit // CHECK-NEXT: FieldDecl {{0x[0-9a-fA-F]+}} <> implicit h 'element [row_count] __attribute__((ext_vector_type(col_count)))' diff --git a/tools/clang/test/HLSLFileCheck/hlsl/types/vector/vector-ast.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/types/vector/vector-ast.hlsl index 0ad236a4b2..12859b7eda 100644 --- a/tools/clang/test/HLSLFileCheck/hlsl/types/vector/vector-ast.hlsl +++ b/tools/clang/test/HLSLFileCheck/hlsl/types/vector/vector-ast.hlsl @@ -12,6 +12,7 @@ // Verify the class, final attribute and ext_vector field decl. // CHECK-NEXT: CXXRecordDecl {{0x[0-9a-fA-F]+}} <> implicit class vector definition // CHECK-NEXT: FinalAttr {{0x[0-9a-fA-F]+}} <> Implicit final +// CHECK-NEXT: HLSLVectorAttr {{0x[0-9a-fA-F]+}} <> Implicit // CHECK-NEXT: FieldDecl {{0x[0-9a-fA-F]+}} <> implicit h 'element __attribute__((ext_vector_type(element_count)))' // Verify operator overloads for const vector subscript operators. From 20c2609253a50817de2d1d1884ef414f80fdd592 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Tue, 4 Mar 2025 11:45:49 -0700 Subject: [PATCH 12/45] Use constant vector limit value for cached types Vector types can be cached in a 2D array that has a column for lenghts 1-4. This uses the added contant to indicate the length and for the checks that confirm it isn't exceeded. --- tools/clang/lib/Sema/SemaHLSL.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index 9b1537d03a..ff682ef501 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -2860,8 +2860,9 @@ class HLSLExternalSource : public ExternalSemaSource { TypedefDecl *m_matrixShorthandTypes[HLSLScalarTypeCount][4][4]; // Vector types already built. - QualType m_vectorTypes[HLSLScalarTypeCount][4]; - TypedefDecl *m_vectorTypedefs[HLSLScalarTypeCount][4]; + QualType m_vectorTypes[HLSLScalarTypeCount][DXIL::kDefaultMaxVectorLength]; + TypedefDecl + *m_vectorTypedefs[HLSLScalarTypeCount][DXIL::kDefaultMaxVectorLength]; // BuiltinType for each scalar type. QualType m_baseTypes[HLSLScalarTypeCount]; @@ -3840,7 +3841,7 @@ class HLSLExternalSource : public ExternalSemaSource { clang::TypedefDecl *LookupVectorShorthandType(HLSLScalarType scalarType, UINT colCount) { DXASSERT_NOMSG(scalarType != HLSLScalarType::HLSLScalarType_unknown && - colCount <= 4); + colCount <= DXIL::kDefaultMaxVectorLength); TypedefDecl *qts = m_vectorTypedefs[scalarType][colCount - 1]; if (qts == nullptr) { QualType type = LookupVectorType(scalarType, colCount); @@ -3948,7 +3949,7 @@ class HLSLExternalSource : public ExternalSemaSource { QualType LookupVectorType(HLSLScalarType scalarType, unsigned int colCount) { QualType qt; - if (colCount < 4) + if (colCount < DXIL::kDefaultMaxVectorLength) qt = m_vectorTypes[scalarType][colCount - 1]; if (qt.isNull()) { if (m_scalarTypes[scalarType].isNull()) { @@ -3957,7 +3958,7 @@ class HLSLExternalSource : public ExternalSemaSource { qt = GetOrCreateVectorSpecialization(*m_context, m_sema, m_vectorTemplateDecl, m_scalarTypes[scalarType], colCount); - if (colCount < 4) + if (colCount < DXIL::kDefaultMaxVectorLength) m_vectorTypes[scalarType][colCount - 1] = qt; } return qt; From 1b3ad427e556c9d7e8086f7dd3971d2c1e070f19 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Sun, 2 Mar 2025 22:46:38 -0700 Subject: [PATCH 13/45] Use definitiondata bits to determine long vector presence By setting the bit when the vector template is instantiated and then propagating it when members, be they standard members or base classes, the bit will be set correctly for any struct or struct-like type. For arrays, the arrays are pealed away in a utility function to get at the elements. Decided to separate the check for completeness from the check for long vectors. Even though the latter almost always requires the former, they are separate concepts and embedding the first in the second would be unexpected --- tools/clang/include/clang/AST/DeclCXX.h | 11 +++ tools/clang/include/clang/Sema/SemaHLSL.h | 3 +- tools/clang/lib/AST/DeclCXX.cpp | 60 ++++++------ tools/clang/lib/Sema/SemaDXR.cpp | 3 +- tools/clang/lib/Sema/SemaHLSL.cpp | 97 ++++++++----------- tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp | 6 +- .../lib/Sema/SemaTemplateInstantiate.cpp | 12 +++ tools/clang/test/SemaHLSL/const-default.hlsl | 4 + .../clang/test/SemaHLSL/incomplete-type.hlsl | 1 + 9 files changed, 105 insertions(+), 92 deletions(-) diff --git a/tools/clang/include/clang/AST/DeclCXX.h b/tools/clang/include/clang/AST/DeclCXX.h index 3b07576545..36e0f99c82 100644 --- a/tools/clang/include/clang/AST/DeclCXX.h +++ b/tools/clang/include/clang/AST/DeclCXX.h @@ -465,6 +465,10 @@ class CXXRecordDecl : public RecordDecl { /// \brief Whether we are currently parsing base specifiers. bool IsParsingBaseSpecifiers : 1; + /// \brief Whether this class contains at least one member or base + /// class containing an HLSL vector longer than 4 elements. + bool HasHLSLLongVector : 1; + /// \brief The number of base class specifiers in Bases. unsigned NumBases; @@ -1018,6 +1022,13 @@ class CXXRecordDecl : public RecordDecl { return data().NeedOverloadResolutionForDestructor; } + // HLSL Change add HLSL Long vector bit. + /// \brief Determine whether this class contains an HLSL long vector + /// of over 4 elements. + bool hasHLSLLongVector() { return data().HasHLSLLongVector; } + /// \brief Set that this class contains an HLSL long vector of over 4 elements + bool setHasHLSLLongVector() { return data().HasHLSLLongVector = true; } + /// \brief Determine whether this class describes a lambda function object. bool isLambda() const { // An update record can't turn a non-lambda into a lambda. diff --git a/tools/clang/include/clang/Sema/SemaHLSL.h b/tools/clang/include/clang/Sema/SemaHLSL.h index d31e32acbb..7e7400d390 100644 --- a/tools/clang/include/clang/Sema/SemaHLSL.h +++ b/tools/clang/include/clang/Sema/SemaHLSL.h @@ -128,8 +128,7 @@ unsigned CaculateInitListArraySizeForHLSL(clang::Sema *sema, const clang::InitListExpr *InitList, const clang::QualType EltTy); -bool ContainsVectorLongerThan(clang::Sema *S, clang::QualType qt, - unsigned length); +bool ContainsLongVector(clang::QualType qt); bool IsConversionToLessOrEqualElements(clang::Sema *self, const clang::ExprResult &sourceExpr, diff --git a/tools/clang/lib/AST/DeclCXX.cpp b/tools/clang/lib/AST/DeclCXX.cpp index 9ef771b932..5f8c186919 100644 --- a/tools/clang/lib/AST/DeclCXX.cpp +++ b/tools/clang/lib/AST/DeclCXX.cpp @@ -48,34 +48,31 @@ void LazyASTUnresolvedSet::getFromExternalSource(ASTContext &C) const { } CXXRecordDecl::DefinitionData::DefinitionData(CXXRecordDecl *D) - : UserDeclaredConstructor(false), UserDeclaredSpecialMembers(0), - Aggregate(true), PlainOldData(true), Empty(true), Polymorphic(false), - Abstract(false), IsStandardLayout(true), HasNoNonEmptyBases(true), - HasPrivateFields(false), HasProtectedFields(false), HasPublicFields(false), - HasMutableFields(false), HasVariantMembers(false), HasOnlyCMembers(true), - HasInClassInitializer(false), HasUninitializedReferenceMember(false), - NeedOverloadResolutionForMoveConstructor(false), - NeedOverloadResolutionForMoveAssignment(false), - NeedOverloadResolutionForDestructor(false), - DefaultedMoveConstructorIsDeleted(false), - DefaultedMoveAssignmentIsDeleted(false), - DefaultedDestructorIsDeleted(false), - HasTrivialSpecialMembers(SMF_All), - DeclaredNonTrivialSpecialMembers(0), - HasIrrelevantDestructor(true), - HasConstexprNonCopyMoveConstructor(false), - DefaultedDefaultConstructorIsConstexpr(true), - HasConstexprDefaultConstructor(false), - HasNonLiteralTypeFieldsOrBases(false), ComputedVisibleConversions(false), - UserProvidedDefaultConstructor(false), DeclaredSpecialMembers(0), - ImplicitCopyConstructorHasConstParam(true), - ImplicitCopyAssignmentHasConstParam(true), - HasDeclaredCopyConstructorWithConstParam(false), - HasDeclaredCopyAssignmentWithConstParam(false), - IsLambda(false), IsParsingBaseSpecifiers(false), NumBases(0), NumVBases(0), - Bases(), VBases(), - Definition(D), FirstFriend() { -} + : UserDeclaredConstructor(false), UserDeclaredSpecialMembers(0), + Aggregate(true), PlainOldData(true), Empty(true), Polymorphic(false), + Abstract(false), IsStandardLayout(true), HasNoNonEmptyBases(true), + HasPrivateFields(false), HasProtectedFields(false), + HasPublicFields(false), HasMutableFields(false), HasVariantMembers(false), + HasOnlyCMembers(true), HasInClassInitializer(false), + HasUninitializedReferenceMember(false), + NeedOverloadResolutionForMoveConstructor(false), + NeedOverloadResolutionForMoveAssignment(false), + NeedOverloadResolutionForDestructor(false), + DefaultedMoveConstructorIsDeleted(false), + DefaultedMoveAssignmentIsDeleted(false), + DefaultedDestructorIsDeleted(false), HasTrivialSpecialMembers(SMF_All), + DeclaredNonTrivialSpecialMembers(0), HasIrrelevantDestructor(true), + HasConstexprNonCopyMoveConstructor(false), + DefaultedDefaultConstructorIsConstexpr(true), + HasConstexprDefaultConstructor(false), + HasNonLiteralTypeFieldsOrBases(false), ComputedVisibleConversions(false), + UserProvidedDefaultConstructor(false), DeclaredSpecialMembers(0), + ImplicitCopyConstructorHasConstParam(true), + ImplicitCopyAssignmentHasConstParam(true), + HasDeclaredCopyConstructorWithConstParam(false), + HasDeclaredCopyAssignmentWithConstParam(false), IsLambda(false), + IsParsingBaseSpecifiers(false), HasHLSLLongVector(false), NumBases(0), + NumVBases(0), Bases(), VBases(), Definition(D), FirstFriend() {} CXXBaseSpecifier *CXXRecordDecl::DefinitionData::getBasesSlowCase() const { return Bases.get(Definition->getASTContext().getExternalSource()); @@ -204,6 +201,10 @@ CXXRecordDecl::setBases(CXXBaseSpecifier const * const *Bases, if (!BaseClassDecl->isStandardLayout()) data().IsStandardLayout = false; + // Propagate presence of long vector to child classes. + if (BaseClassDecl->hasHLSLLongVector()) + data().HasHLSLLongVector = true; + // Record if this base is the first non-literal field or base. if (!hasNonLiteralTypeFieldsOrBases() && !BaseType->isLiteralType(C)) data().HasNonLiteralTypeFieldsOrBases = true; @@ -385,6 +386,9 @@ void CXXRecordDecl::addedClassSubobject(CXXRecordDecl *Subobj) { data().NeedOverloadResolutionForMoveConstructor = true; data().NeedOverloadResolutionForDestructor = true; } + + if (Subobj->hasHLSLLongVector()) + data().HasHLSLLongVector = true; } /// Callback function for CXXRecordDecl::forallBases that acknowledges diff --git a/tools/clang/lib/Sema/SemaDXR.cpp b/tools/clang/lib/Sema/SemaDXR.cpp index 32ca88c27a..d71dc2be4c 100644 --- a/tools/clang/lib/Sema/SemaDXR.cpp +++ b/tools/clang/lib/Sema/SemaDXR.cpp @@ -810,8 +810,7 @@ void DiagnoseTraceCall(Sema &S, const VarDecl *Payload, return; } - if (hlsl::ContainsVectorLongerThan(&S, Payload->getType(), - DXIL::kDefaultMaxVectorLength)) { + if (ContainsLongVector(Payload->getType())) { S.Diag(Payload->getLocation(), diag::err_hlsl_unsupported_long_vector) << DXIL::kDefaultMaxVectorLength << "payload parameters"; return; diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index ff682ef501..fc6e7004d4 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -942,6 +942,11 @@ GetOrCreateVectorSpecialization(ASTContext &context, Sema *sema, "otherwise vector handle cannot be looked up"); #endif + // I don't think this is necessary. + CXXRecordDecl *Decl = vectorSpecializationType->getAsCXXRecordDecl(); + if (GetHLSLVecSize(vectorSpecializationType) > DXIL::kDefaultMaxVectorLength) + Decl->setHasHLSLLongVector(); + return vectorSpecializationType; } @@ -5255,20 +5260,14 @@ class HLSLExternalSource : public ExternalSemaSource { << argType; return true; } - if (ContainsVectorLongerThan(m_sema, argType, - DXIL::kDefaultMaxVectorLength)) { + m_sema->RequireCompleteType(argSrcLoc, argType, + diag::err_typecheck_decl_incomplete_type); + + if (ContainsLongVector(argType)) { m_sema->Diag(argSrcLoc, diag::err_hlsl_unsupported_long_vector) << DXIL::kDefaultMaxVectorLength << "cbuffers"; return true; } - - if (const RecordType *recordType = argType->getAs()) { - if (!recordType->getDecl()->isCompleteDefinition()) { - m_sema->Diag(argSrcLoc, diag::err_typecheck_decl_incomplete_type) - << argType; - return true; - } - } } return false; @@ -5341,9 +5340,10 @@ class HLSLExternalSource : public ExternalSemaSource { const TemplateArgument &arg = argLoc.getArgument(); DXASSERT(arg.getKind() == TemplateArgument::ArgKind::Type, "Tessellation patch requires type template arg 0"); - QualType argType = arg.getAsType(); - if (ContainsVectorLongerThan(m_sema, argType, - DXIL::kDefaultMaxVectorLength)) { + + m_sema->RequireCompleteType(argLoc.getLocation(), arg.getAsType(), + diag::err_typecheck_decl_incomplete_type); + if (ContainsLongVector(arg.getAsType())) { m_sema->Diag(argLoc.getLocation(), diag::err_hlsl_unsupported_long_vector) << DXIL::kDefaultMaxVectorLength << "tessellation patches"; @@ -5356,9 +5356,9 @@ class HLSLExternalSource : public ExternalSemaSource { const TemplateArgument &arg = argLoc.getArgument(); DXASSERT(arg.getKind() == TemplateArgument::ArgKind::Type, "Geometry stream requires type template arg 0"); - QualType argType = arg.getAsType(); - if (ContainsVectorLongerThan(m_sema, argType, - DXIL::kDefaultMaxVectorLength)) { + m_sema->RequireCompleteType(argLoc.getLocation(), arg.getAsType(), + diag::err_typecheck_decl_incomplete_type); + if (ContainsLongVector(arg.getAsType())) { m_sema->Diag(argLoc.getLocation(), diag::err_hlsl_unsupported_long_vector) << DXIL::kDefaultMaxVectorLength << "geometry streams"; @@ -12099,39 +12099,17 @@ bool hlsl::ShouldSkipNRVO(clang::Sema &sema, clang::QualType returnType, return false; } -bool hlsl::ContainsVectorLongerThan(Sema *S, QualType qt, unsigned length) { +bool hlsl::ContainsLongVector(QualType qt) { if (qt.isNull() || qt->isDependentType()) return false; - if (IsHLSLVecType(qt)) { - if (GetHLSLVecSize(qt) > length) - return true; - } else if (qt->isArrayType()) { - const ArrayType *arrayType = qt->getAsArrayTypeUnsafe(); - return ContainsVectorLongerThan(S, arrayType->getElementType(), length); - } else if (qt->isStructureOrClassType()) { - const RecordType *recordType = qt->getAs(); - RecordDecl *recordDecl = recordType->getDecl(); - if (recordDecl->isInvalidDecl()) - return false; - if (ClassTemplateSpecializationDecl *templateSpecializationDecl = - dyn_cast(recordDecl)) { - if (templateSpecializationDecl->getSpecializationKind() == - TSK_Undeclared) { - S->RequireCompleteType(recordDecl->getLocation(), qt, - diag::err_typecheck_decl_incomplete_type); - } - } - if (!recordDecl->isCompleteDefinition()) + while (const ArrayType *Arr = qt->getAsArrayTypeUnsafe()) + qt = Arr->getElementType(); + + if (CXXRecordDecl *Decl = qt->getAsCXXRecordDecl()) { + if (!Decl->isCompleteDefinition()) return false; - for (FieldDecl *FD : recordDecl->fields()) - if (ContainsVectorLongerThan(S, FD->getType(), length)) - return true; - if (auto *Child = dyn_cast(recordDecl)) - // Walk up the inheritance chain and check all fields on base classes - for (auto &B : Child->bases()) - if (ContainsVectorLongerThan(S, B.getType(), length)) - return true; + return Decl->hasHLSLLongVector(); } return false; } @@ -14765,11 +14743,21 @@ bool Sema::DiagnoseHLSLDecl(Declarator &D, DeclContext *DC, Expr *BitWidth, } // Disallow long vecs from $Global cbuffers. - if (isGlobal && !isStatic && !isGroupShared && - ContainsVectorLongerThan(this, qt, DXIL::kDefaultMaxVectorLength)) { - Diag(D.getLocStart(), diag::err_hlsl_unsupported_long_vector) - << DXIL::kDefaultMaxVectorLength << "cbuffers"; - result = false; + if (isGlobal && !isStatic && !isGroupShared) { + if (qt->isStructureOrClassType()) { + if (ClassTemplateSpecializationDecl *templateSpecializationDecl = + dyn_cast( + qt->getAsCXXRecordDecl())) + if (templateSpecializationDecl->getSpecializationKind() == + TSK_Undeclared) + RequireCompleteType(D.getLocStart(), qt, + diag::err_typecheck_decl_incomplete_type); + } + if (ContainsLongVector(qt)) { + Diag(D.getLocStart(), diag::err_hlsl_unsupported_long_vector) + << DXIL::kDefaultMaxVectorLength << "cbuffers"; + result = false; + } } // SPIRV change starts @@ -15662,8 +15650,7 @@ static bool isRelatedDeclMarkedNointerpolation(Expr *E) { // Verify that user-defined intrinsic struct args contain no long vectors static bool CheckUDTIntrinsicArg(Sema *S, Expr *Arg) { - if (ContainsVectorLongerThan(S, Arg->getType(), - DXIL::kDefaultMaxVectorLength)) { + if (ContainsLongVector(Arg->getType())) { S->Diag(Arg->getExprLoc(), diag::err_hlsl_unsupported_long_vector) << DXIL::kDefaultMaxVectorLength << "user-defined struct parameter"; return true; @@ -16404,14 +16391,12 @@ void DiagnoseEntry(Sema &S, FunctionDecl *FD) { // Check general parameter characteristics // Would be nice to check for resources here as they crash the compiler now. for (const auto *param : FD->params()) { - if (ContainsVectorLongerThan(&S, param->getType(), - DXIL::kDefaultMaxVectorLength)) + if (ContainsLongVector(param->getType())) S.Diag(param->getLocation(), diag::err_hlsl_unsupported_long_vector) << DXIL::kDefaultMaxVectorLength << "entry function parameters"; } - if (ContainsVectorLongerThan(&S, FD->getReturnType(), - DXIL::kDefaultMaxVectorLength)) + if (ContainsLongVector(FD->getReturnType())) S.Diag(FD->getLocation(), diag::err_hlsl_unsupported_long_vector) << DXIL::kDefaultMaxVectorLength << "entry function return type"; diff --git a/tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp b/tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp index 6645c4c3d2..2275c48114 100644 --- a/tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp +++ b/tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp @@ -521,15 +521,13 @@ void hlsl::DiagnoseTranslationUnit(clang::Sema *self) { } } for (const auto *param : pPatchFnDecl->params()) - if (ContainsVectorLongerThan(self, param->getType(), - DXIL::kDefaultMaxVectorLength)) + if (ContainsLongVector(param->getType())) self->Diag(param->getLocation(), diag::err_hlsl_unsupported_long_vector) << DXIL::kDefaultMaxVectorLength << "patch constant function parameters"; - if (ContainsVectorLongerThan(self, pPatchFnDecl->getReturnType(), - DXIL::kDefaultMaxVectorLength)) + if (ContainsLongVector(pPatchFnDecl->getReturnType())) self->Diag(pPatchFnDecl->getLocation(), diag::err_hlsl_unsupported_long_vector) << DXIL::kDefaultMaxVectorLength diff --git a/tools/clang/lib/Sema/SemaTemplateInstantiate.cpp b/tools/clang/lib/Sema/SemaTemplateInstantiate.cpp index a6ae05faa5..1eacedbb0b 100644 --- a/tools/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/tools/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -2139,6 +2139,18 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, SourceLocation(), SourceLocation(), nullptr); CheckCompletedCXXClass(Instantiation); + // HLSL Change Begin - set longvec bit for vectors of over 4 elements + ClassTemplateSpecializationDecl *Spec = + dyn_cast(Instantiation); + if (Spec && Spec->hasAttr()) { + const TemplateArgumentList &argList = Spec->getTemplateArgs(); + const TemplateArgument &arg1 = argList[1]; + llvm::APSInt vecSize = arg1.getAsIntegral(); + if (vecSize.getLimitedValue() > hlsl::DXIL::kDefaultMaxVectorLength) + Instantiation->setHasHLSLLongVector(); + } + // HLSL Change End - set longvec bit for vectors of over 4 elements + // Default arguments are parsed, if not instantiated. We can go instantiate // default arg exprs for default constructors if necessary now. ActOnFinishCXXMemberDefaultArgs(Instantiation); diff --git a/tools/clang/test/SemaHLSL/const-default.hlsl b/tools/clang/test/SemaHLSL/const-default.hlsl index 2ebb6fe52e..6b5e43e0e9 100644 --- a/tools/clang/test/SemaHLSL/const-default.hlsl +++ b/tools/clang/test/SemaHLSL/const-default.hlsl @@ -33,7 +33,11 @@ class MyClass { ConstantBuffer g_const_buffer2; TextureBuffer g_texture_buffer2; +// expected-note@+2 {{forward declaration of 'FWDDeclStruct'}} +// expected-note@+1 {{forward declaration of 'FWDDeclStruct'}} struct FWDDeclStruct; +// expected-note@+2 {{forward declaration of 'FWDDeclClass'}} +// expected-note@+1 {{forward declaration of 'FWDDeclClass'}} class FWDDeclClass; // Ensure forward declared struct/class fails as expected diff --git a/tools/clang/test/SemaHLSL/incomplete-type.hlsl b/tools/clang/test/SemaHLSL/incomplete-type.hlsl index 8869b80400..250171ad05 100644 --- a/tools/clang/test/SemaHLSL/incomplete-type.hlsl +++ b/tools/clang/test/SemaHLSL/incomplete-type.hlsl @@ -3,6 +3,7 @@ // Tests that the compiler is well-behaved with regard to uses of incomplete types. // Regression test for GitHub #2058, which crashed in this case. +// expected-note@+5 {{forward declaration of 'S'}} // expected-note@+4 {{forward declaration of 'S'}} // expected-note@+3 {{forward declaration of 'S'}} // expected-note@+2 {{forward declaration of 'S'}} From d3fec833e31f2b375279c5ca48ed7655ee685272 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Wed, 5 Mar 2025 19:17:41 -0700 Subject: [PATCH 14/45] Test for incomplete types in a number of builtin template-like objects Output Streams, Tessellation patches, and global variables should be complete when receiving other correctness checks. If they cannot be made complete, they should produce an error. This was omitted for various of these including non-template globals, which was fine, but it meant that redundant errors were produced for templates, but not standard globals likely just because that was what was tested. This removes that distinction and adds testing for all of the above to the existing incomplete-type.hlsl test. --- tools/clang/lib/Sema/SemaHLSL.cpp | 45 +++++----- ...ent_type_for_node_object_template_arg.hlsl | 3 - .../clang/test/SemaHLSL/incomplete-type.hlsl | 87 +++++++++++++++++-- 3 files changed, 101 insertions(+), 34 deletions(-) diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index fc6e7004d4..8abad632a2 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -5296,22 +5296,13 @@ class HLSLExternalSource : public ExternalSemaSource { // template instantiation. if (ArgTy->isDependentType()) return false; - if (auto *recordType = ArgTy->getAs()) { - if (CXXRecordDecl *cxxRecordDecl = - dyn_cast(recordType->getDecl())) { - if (ClassTemplateSpecializationDecl *templateSpecializationDecl = - dyn_cast(cxxRecordDecl)) { - if (templateSpecializationDecl->getSpecializationKind() == - TSK_Undeclared) { - // Make sure specialization is done before IsTypeNumeric. - // If not, ArgTy might be treat as empty struct. - m_sema->RequireCompleteType( - ArgLoc.getLocation(), ArgTy, - diag::err_typecheck_decl_incomplete_type); - } - } - } - } + // Make sure specialization is done before IsTypeNumeric. + // If not, ArgTy might be treat as empty struct. + m_sema->RequireCompleteType(ArgLoc.getLocation(), ArgTy, + diag::err_typecheck_decl_incomplete_type); + CXXRecordDecl *Decl = ArgTy->getAsCXXRecordDecl(); + if (Decl && !Decl->isCompleteDefinition()) + return true; // The node record type must be compound - error if it is not. if (GetTypeObjectKind(ArgTy) != AR_TOBJ_COMPOUND) { m_sema->Diag(ArgLoc.getLocation(), diag::err_hlsl_node_record_type) @@ -5343,6 +5334,9 @@ class HLSLExternalSource : public ExternalSemaSource { m_sema->RequireCompleteType(argLoc.getLocation(), arg.getAsType(), diag::err_typecheck_decl_incomplete_type); + CXXRecordDecl *Decl = arg.getAsType()->getAsCXXRecordDecl(); + if (Decl && !Decl->isCompleteDefinition()) + return true; if (ContainsLongVector(arg.getAsType())) { m_sema->Diag(argLoc.getLocation(), diag::err_hlsl_unsupported_long_vector) @@ -5358,6 +5352,9 @@ class HLSLExternalSource : public ExternalSemaSource { "Geometry stream requires type template arg 0"); m_sema->RequireCompleteType(argLoc.getLocation(), arg.getAsType(), diag::err_typecheck_decl_incomplete_type); + CXXRecordDecl *Decl = arg.getAsType()->getAsCXXRecordDecl(); + if (Decl && !Decl->isCompleteDefinition()) + return true; if (ContainsLongVector(arg.getAsType())) { m_sema->Diag(argLoc.getLocation(), diag::err_hlsl_unsupported_long_vector) @@ -14744,15 +14741,13 @@ bool Sema::DiagnoseHLSLDecl(Declarator &D, DeclContext *DC, Expr *BitWidth, // Disallow long vecs from $Global cbuffers. if (isGlobal && !isStatic && !isGroupShared) { - if (qt->isStructureOrClassType()) { - if (ClassTemplateSpecializationDecl *templateSpecializationDecl = - dyn_cast( - qt->getAsCXXRecordDecl())) - if (templateSpecializationDecl->getSpecializationKind() == - TSK_Undeclared) - RequireCompleteType(D.getLocStart(), qt, - diag::err_typecheck_decl_incomplete_type); - } + // Suppress actual emitting of errors for incompletable types here + // They are redundant to those produced in ActOnUninitializedDecl. + struct SilentDiagnoser : public TypeDiagnoser { + SilentDiagnoser() : TypeDiagnoser(true) {} + virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) {} + } SD; + RequireCompleteType(D.getLocStart(), qt, SD); if (ContainsLongVector(qt)) { Diag(D.getLocStart(), diag::err_hlsl_unsupported_long_vector) << DXIL::kDefaultMaxVectorLength << "cbuffers"; diff --git a/tools/clang/test/SemaHLSL/hlsl/workgraph/dependent_type_for_node_object_template_arg.hlsl b/tools/clang/test/SemaHLSL/hlsl/workgraph/dependent_type_for_node_object_template_arg.hlsl index 40e0452719..05ec268a0c 100644 --- a/tools/clang/test/SemaHLSL/hlsl/workgraph/dependent_type_for_node_object_template_arg.hlsl +++ b/tools/clang/test/SemaHLSL/hlsl/workgraph/dependent_type_for_node_object_template_arg.hlsl @@ -60,12 +60,9 @@ void woo() { } template -// expected-note@+1{{zero sized record defined here}} struct ForwardDecl; // expected-note{{template is declared here}} void woot() { - // Forward decl fails because forcing completion to check empty size for node object. - // expected-error@+1{{record used in GroupNodeInputRecords may not have zero size}} GroupNodeInputRecords > data; // expected-error{{implicit instantiation of undefined template 'ForwardDecl'}} foo(data); } diff --git a/tools/clang/test/SemaHLSL/incomplete-type.hlsl b/tools/clang/test/SemaHLSL/incomplete-type.hlsl index 250171ad05..a2856f448e 100644 --- a/tools/clang/test/SemaHLSL/incomplete-type.hlsl +++ b/tools/clang/test/SemaHLSL/incomplete-type.hlsl @@ -1,18 +1,93 @@ -// RUN: %dxc -Tlib_6_3 -Wno-unused-value -verify %s +// RUN: %dxc -Tlib_6_8 -Wno-unused-value -verify %s // Tests that the compiler is well-behaved with regard to uses of incomplete types. // Regression test for GitHub #2058, which crashed in this case. -// expected-note@+5 {{forward declaration of 'S'}} -// expected-note@+4 {{forward declaration of 'S'}} -// expected-note@+3 {{forward declaration of 'S'}} -// expected-note@+2 {{forward declaration of 'S'}} -// expected-note@+1 {{forward declaration of 'S'}} +// expected-note@+8 {{forward declaration of 'S'}} expected-note@+8 {{forward declaration of 'S'}} expected-note@+8 {{forward declaration of 'S'}} +// expected-note@+7 {{forward declaration of 'S'}} expected-note@+7 {{forward declaration of 'S'}} expected-note@+7 {{forward declaration of 'S'}} +// expected-note@+6 {{forward declaration of 'S'}} expected-note@+6 {{forward declaration of 'S'}} expected-note@+6 {{forward declaration of 'S'}} +// expected-note@+5 {{forward declaration of 'S'}} expected-note@+5 {{forward declaration of 'S'}} expected-note@+5 {{forward declaration of 'S'}} +// expected-note@+4 {{forward declaration of 'S'}} expected-note@+4 {{forward declaration of 'S'}} expected-note@+4 {{forward declaration of 'S'}} +// expected-note@+3 {{forward declaration of 'S'}} expected-note@+3 {{forward declaration of 'S'}} expected-note@+3 {{forward declaration of 'S'}} +// expected-note@+2 {{forward declaration of 'S'}} expected-note@+2 {{forward declaration of 'S'}} expected-note@+2 {{forward declaration of 'S'}} +// expected-note@+1 {{forward declaration of 'S'}} expected-note@+1 {{forward declaration of 'S'}} expected-note@+1 {{forward declaration of 'S'}} struct S; + +// expected-note@+2 {{template is declared here}} +// expected-note@+1 {{template is declared here}} expected-note@+1 {{template is declared here}} expected-note@+1 {{template is declared here}} +template struct T; + ConstantBuffer CB; // expected-error {{variable has incomplete type 'S'}} +ConstantBuffer > TB; // expected-error {{implicit instantiation of undefined template 'T<1>'}} + +S s; // expected-error {{variable has incomplete type 'S'}} +T<1> t; // expected-error {{implicit instantiation of undefined template 'T<1>'}} + +cbuffer BadBuffy { + S cb_s; // expected-error {{variable has incomplete type 'S'}} + T<1> cb_t; // expected-error {{implicit instantiation of undefined template 'T<1>'}} +}; + +tbuffer BadTuffy { + S tb_s; // expected-error {{variable has incomplete type 'S'}} + T<1> tb_t; // expected-error {{implicit instantiation of undefined template 'T<1>'}} +}; + S func( // expected-error {{incomplete result type 'S' in function definition}} S param) // expected-error {{variable has incomplete type 'S'}} { S local; // expected-error {{variable has incomplete type 'S'}} return (S)0; // expected-error {{'S' is an incomplete type}} } + +[shader("geometry")] +[maxvertexcount(3)] +void gs_point(line S e, // expected-error {{variable has incomplete type 'S'}} + inout PointStream OutputStream0) {} // expected-error {{variable has incomplete type 'S'}} + +[shader("geometry")] +[maxvertexcount(12)] +void gs_line(line S a, // expected-error {{variable has incomplete type 'S'}} + inout LineStream OutputStream0) {} // expected-error {{variable has incomplete type 'S'}} + + +[shader("geometry")] +[maxvertexcount(12)] +void gs_line(line S a, // expected-error {{variable has incomplete type 'S'}} + inout TriangleStream OutputStream0) {} // expected-error {{variable has incomplete type 'S'}} + + +[shader("domain")] +[domain("tri")] +void ds_main(OutputPatch TrianglePatch) {} // expected-error{{variable has incomplete type 'S'}} + +void patch_const(InputPatch inpatch, // expected-error{{variable has incomplete type 'S'}} + OutputPatch outpatch) {} // expected-error{{variable has incomplete type 'S'}} + +[shader("hull")] +[domain("tri")] +[outputtopology("triangle_cw")] +[outputcontrolpoints(32)] +[patchconstantfunc("patch_const")] +void hs_main(InputPatch TrianglePatch) {} // expected-error{{variable has incomplete type 'S'}} + +[Shader("node")] +[NodeLaunch("broadcasting")] +[NumThreads(8,1,1)] +[NodeMaxDispatchGrid(8,1,1)] +// expected-error@+1{{Broadcasting node shader 'broadcast' with NodeMaxDispatchGrid attribute must declare an input record containing a field with SV_DispatchGrid semantic}} +void broadcast(DispatchNodeInputRecord input, // expected-error{{variable has incomplete type 'S'}} + NodeOutput output) // expected-error{{variable has incomplete type 'S'}} +{ + ThreadNodeOutputRecords touts; // expected-error{{variable has incomplete type 'S'}} + GroupNodeOutputRecords gouts; // expected-error{{variable has incomplete type 'S'}} +} + +[Shader("node")] +[NodeLaunch("coalescing")] +[NumThreads(8,1,1)] +void coalesce(GroupNodeInputRecords input) {} // expected-error{{variable has incomplete type 'S'}} + +[Shader("node")] +[NodeLaunch("thread")] +void threader(ThreadNodeInputRecord input) {} // expected-error{{variable has incomplete type 'S'}} From 50d1af5b645651b7ee4d4ef063bdc88c7d6790d4 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Mon, 10 Mar 2025 04:10:08 -0600 Subject: [PATCH 15/45] Respond to feedback remove some stale elements. Add some HLSL type helper functions and add some new ones. Make resource type retreiveals type-safe. Add some parameter comments and names to make clearer what the effect of them are. Pass resource attribute to cbuffer/tbuffer creation. Clean up and clarify error messages. Remove redundant type canonization from type queries. Correct resclass of tbuffers. Use multimatch utility of verify to condense checks --- include/dxc/DXIL/DxilConstants.h | 5 +++ lib/DXIL/DxilUtil.cpp | 40 +++++++++---------- tools/clang/include/clang/AST/HlslTypes.h | 2 +- tools/clang/include/clang/Basic/Attr.td | 17 +++++++- .../clang/Basic/DiagnosticSemaKinds.td | 6 +-- tools/clang/lib/AST/ASTContextHLSL.cpp | 15 ++++--- tools/clang/lib/AST/HlslTypes.cpp | 22 ++++------ tools/clang/lib/Sema/SemaDXR.cpp | 2 +- tools/clang/lib/Sema/SemaHLSL.cpp | 34 +++++++--------- tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp | 2 - .../hlsl/types/invalid-longvec-decls.hlsl | 28 ++++++------- .../clang/test/SemaHLSL/incomplete-type.hlsl | 16 ++------ 12 files changed, 90 insertions(+), 99 deletions(-) diff --git a/include/dxc/DXIL/DxilConstants.h b/include/dxc/DXIL/DxilConstants.h index ac894df1d6..b3c510a038 100644 --- a/include/dxc/DXIL/DxilConstants.h +++ b/include/dxc/DXIL/DxilConstants.h @@ -465,6 +465,11 @@ inline bool IsTBuffer(DXIL::ResourceKind ResourceKind) { return ResourceKind == DXIL::ResourceKind::TBuffer; } +inline bool IsCTBuffer(DXIL::ResourceKind ResourceKind) { + return ResourceKind == DXIL::ResourceKind::CBuffer || + ResourceKind == DXIL::ResourceKind::TBuffer; +} + /// Whether the resource kind is a FeedbackTexture. inline bool IsFeedbackTexture(DXIL::ResourceKind ResourceKind) { return ResourceKind == DXIL::ResourceKind::FeedbackTexture2D || diff --git a/lib/DXIL/DxilUtil.cpp b/lib/DXIL/DxilUtil.cpp index 757a0bc3ee..065f19d7d0 100644 --- a/lib/DXIL/DxilUtil.cpp +++ b/lib/DXIL/DxilUtil.cpp @@ -427,34 +427,34 @@ GetHLSLResourceProperties(llvm::Type *Ty) { if (name == "SamplerComparisonState") return RetType( - true, MakeResourceProperties(hlsl::DXIL::ResourceKind::Sampler, false, - false, /*cmp or counter*/ true)); + true, MakeResourceProperties(hlsl::DXIL::ResourceKind::Sampler, /*UAV*/ false, + /*ROV*/ false, /*cmp or counter*/ true)); if (name.startswith("AppendStructuredBuffer<")) return RetType(true, MakeResourceProperties( hlsl::DXIL::ResourceKind::StructuredBuffer, - false, false, /*cmp or counter*/ true)); + /*UAV*/ true, /*ROV*/ false, /*cmp or counter*/ true)); if (name.startswith("ConsumeStructuredBuffer<")) return RetType(true, MakeResourceProperties( hlsl::DXIL::ResourceKind::StructuredBuffer, - false, false, /*cmp or counter*/ true)); + /*UAV*/ false, /*ROV*/ false, /*cmp or counter*/ true)); if (name == "RaytracingAccelerationStructure") return RetType(true, MakeResourceProperties( hlsl::DXIL::ResourceKind::RTAccelerationStructure, - false, false, false)); + /*UAV*/ false, /*ROV*/ false, false)); if (name.startswith("ConstantBuffer<")) return RetType(true, MakeResourceProperties(hlsl::DXIL::ResourceKind::CBuffer, - false, false, false)); + /*UAV*/ false, /*ROV*/ false, false)); if (name.startswith("TextureBuffer<")) return RetType(true, MakeResourceProperties(hlsl::DXIL::ResourceKind::TBuffer, - false, false, false)); + /*UAV*/ false, /*ROV*/ false, false)); if (ConsumePrefix(name, "FeedbackTexture2D")) { hlsl::DXIL::ResourceKind kind = hlsl::DXIL::ResourceKind::Invalid; @@ -464,7 +464,7 @@ GetHLSLResourceProperties(llvm::Type *Ty) { kind = hlsl::DXIL::ResourceKind::FeedbackTexture2D; if (name.startswith("<")) - return RetType(true, MakeResourceProperties(kind, false, false, false)); + return RetType(true, MakeResourceProperties(kind, /*UAV*/ false, /*ROV*/ false, /*Cmp*/ false)); return FalseRet; } @@ -475,63 +475,63 @@ GetHLSLResourceProperties(llvm::Type *Ty) { if (name == "ByteAddressBuffer") return RetType(true, MakeResourceProperties(hlsl::DXIL::ResourceKind::RawBuffer, - UAV, ROV, false)); + UAV, ROV, /*Cmp*/ false)); if (name.startswith("Buffer<")) return RetType( true, MakeResourceProperties(hlsl::DXIL::ResourceKind::TypedBuffer, - UAV, ROV, false)); + UAV, ROV, /*Cmp*/ false)); if (name.startswith("StructuredBuffer<")) return RetType(true, MakeResourceProperties( hlsl::DXIL::ResourceKind::StructuredBuffer, UAV, - ROV, false)); + ROV, /*Cmp*/ false)); if (ConsumePrefix(name, "Texture")) { if (name.startswith("1D<")) return RetType( true, MakeResourceProperties(hlsl::DXIL::ResourceKind::Texture1D, - UAV, ROV, false)); + UAV, ROV, /*Cmp*/ false)); if (name.startswith("1DArray<")) return RetType(true, MakeResourceProperties( hlsl::DXIL::ResourceKind::Texture1DArray, UAV, - ROV, false)); + ROV, /*Cmp*/ false)); if (name.startswith("2D<")) return RetType( true, MakeResourceProperties(hlsl::DXIL::ResourceKind::Texture2D, - UAV, ROV, false)); + UAV, ROV, /*Cmp*/ false)); if (name.startswith("2DArray<")) return RetType(true, MakeResourceProperties( hlsl::DXIL::ResourceKind::Texture2DArray, UAV, - ROV, false)); + ROV, /*Cmp*/ false)); if (name.startswith("3D<")) return RetType( true, MakeResourceProperties(hlsl::DXIL::ResourceKind::Texture3D, - UAV, ROV, false)); + UAV, ROV, /*Cmp*/ false)); if (name.startswith("Cube<")) return RetType( true, MakeResourceProperties(hlsl::DXIL::ResourceKind::TextureCube, - UAV, ROV, false)); + UAV, ROV, /*Cmp*/ false)); if (name.startswith("CubeArray<")) return RetType(true, MakeResourceProperties( hlsl::DXIL::ResourceKind::TextureCubeArray, - UAV, ROV, false)); + UAV, ROV, /*Cmp*/ false)); if (name.startswith("2DMS<")) return RetType( true, MakeResourceProperties(hlsl::DXIL::ResourceKind::Texture2DMS, - UAV, ROV, false)); + UAV, ROV, /*Cmp*/ false)); if (name.startswith("2DMSArray<")) return RetType(true, MakeResourceProperties( hlsl::DXIL::ResourceKind::Texture2DMSArray, - UAV, ROV, false)); + UAV, ROV, /*Cmp*/ false)); return FalseRet; } } diff --git a/tools/clang/include/clang/AST/HlslTypes.h b/tools/clang/include/clang/AST/HlslTypes.h index 5cd14cbe8a..9fd09b6539 100644 --- a/tools/clang/include/clang/AST/HlslTypes.h +++ b/tools/clang/include/clang/AST/HlslTypes.h @@ -388,7 +388,7 @@ clang::CXXRecordDecl *DeclareUIntTemplatedTypeWithHandleInDeclContext( llvm::StringRef typeName, llvm::StringRef templateParamName, clang::InheritableAttr *Attr = nullptr); clang::CXXRecordDecl *DeclareConstantBufferViewType(clang::ASTContext &context, - bool bTBuf); + clang::InheritableAttr *Attr); clang::CXXRecordDecl *DeclareRayQueryType(clang::ASTContext &context); clang::CXXRecordDecl *DeclareResourceType(clang::ASTContext &context, bool bSampler); diff --git a/tools/clang/include/clang/Basic/Attr.td b/tools/clang/include/clang/Basic/Attr.td index 29430e6d4c..bbc1263e20 100644 --- a/tools/clang/include/clang/Basic/Attr.td +++ b/tools/clang/include/clang/Basic/Attr.td @@ -960,16 +960,29 @@ def HLSLTessPatch : InheritableAttr { def HLSLStreamOutput : InheritableAttr { let Spellings = []; // No spellings! - let Args = [UnsignedArgument<"Vertices">]; + // PrimVertices are the number of vertices that make up the streamed primitive. + // Points have 1. Lines have 2. Triangles have 3. + let Args = [UnsignedArgument<"PrimVertices">]; let Subjects = SubjectList<[CXXRecord]>; let Documentation = [Undocumented]; } def HLSLResource : InheritableAttr { let Spellings = []; // No spellings! - let Args = [UnsignedArgument<"ResKind">, UnsignedArgument<"ResClass">]; + let Args = [UnsignedArgument<"ResKindUint">, UnsignedArgument<"ResClassUint">]; let Subjects = SubjectList<[CXXRecord]>; let Documentation = [Undocumented]; + + // Add enum typed getters for safety and brevity. + let AdditionalMembers = + [{ + hlsl::DXIL::ResourceKind getResKind() const { + return (hlsl::DXIL::ResourceKind)getResKindUint(); + } + hlsl::DXIL::ResourceClass getResClass() const { + return (hlsl::DXIL::ResourceClass)getResClassUint(); + } + }]; } def HLSLNodeLaunch : InheritableAttr { diff --git a/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td b/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td index 4d81b25ccc..5f6b7effce 100644 --- a/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -7519,7 +7519,7 @@ def err_hlsl_half_load_store: Error< "LoadHalf and StoreHalf are not supported for min precision mode">; def err_hlsl_interfaces_cannot_inherit: Error< "interfaces cannot inherit from other types">; -def err_hlsl_invalid_range_1_plus: Error< +def err_hlsl_invalid_range_1_to_max: Error< "invalid value, valid range is between 1 and %0 inclusive">; def err_hlsl_matrix_member_bad_format: Error< "invalid format for matrix subscript '%0'">; @@ -7852,9 +7852,7 @@ def err_hlsl_load_from_mesh_out_arrays: Error< def err_hlsl_out_indices_array_incorrect_access: Error< "a vector in out indices array must be accessed as a whole">; def err_hlsl_unsupported_long_vector: Error< - "Vectors of over %0 elements in %1 are not supported">; -def err_hlsl_vector_too_long: Error< - "Vectors of over %0 elements in are not supported">; + "Vectors of over 4 elements in %0 are not supported">; def err_hlsl_logical_binop_scalar : Error< "operands for short-circuiting logical binary operator must be scalar, for non-scalar types use '%select{and|or}0'">; def err_hlsl_ternary_scalar : Error< diff --git a/tools/clang/lib/AST/ASTContextHLSL.cpp b/tools/clang/lib/AST/ASTContextHLSL.cpp index 9bacfc8b42..0a64772d11 100644 --- a/tools/clang/lib/AST/ASTContextHLSL.cpp +++ b/tools/clang/lib/AST/ASTContextHLSL.cpp @@ -1131,25 +1131,24 @@ CXXRecordDecl *hlsl::DeclareUIntTemplatedTypeWithHandleInDeclContext( } clang::CXXRecordDecl * -hlsl::DeclareConstantBufferViewType(clang::ASTContext &context, bool bTBuf) { +hlsl::DeclareConstantBufferViewType(clang::ASTContext &context, InheritableAttr *Attr) { // Create ConstantBufferView template declaration in translation unit scope // like other resource. // template ConstantBuffer { int h; } DeclContext *DC = context.getTranslationUnitDecl(); + DXASSERT(Attr, "Constbuffer types require an attribute"); - BuiltinTypeDeclBuilder typeDeclBuilder( - DC, bTBuf ? "TextureBuffer" : "ConstantBuffer", - TagDecl::TagKind::TTK_Struct); + const char *TypeName = "ConstantBuffer"; + if (IsTBuffer(cast(Attr)->getResKind())) + TypeName = "TextureBuffer"; + BuiltinTypeDeclBuilder typeDeclBuilder(DC, TypeName, TagDecl::TagKind::TTK_Struct); (void)typeDeclBuilder.addTypeTemplateParam("T"); typeDeclBuilder.startDefinition(); CXXRecordDecl *templateRecordDecl = typeDeclBuilder.getRecordDecl(); typeDeclBuilder.addField( "h", context.UnsignedIntTy); // Add an 'h' field to hold the handle. - - typeDeclBuilder.getRecordDecl()->addAttr(HLSLResourceAttr::CreateImplicit( - context, (unsigned)DXIL::ResourceKind::CBuffer, - (unsigned)DXIL::ResourceClass::CBuffer)); + typeDeclBuilder.getRecordDecl()->addAttr(Attr); typeDeclBuilder.getRecordDecl(); diff --git a/tools/clang/lib/AST/HlslTypes.cpp b/tools/clang/lib/AST/HlslTypes.cpp index e9c443b9d7..41175e3d37 100644 --- a/tools/clang/lib/AST/HlslTypes.cpp +++ b/tools/clang/lib/AST/HlslTypes.cpp @@ -477,37 +477,32 @@ clang::QualType GetHLSLMatElementType(clang::QualType type) { // TODO: Add type cache to ASTContext. bool IsHLSLInputPatchType(QualType type) { - type = type.getCanonicalType(); if (const HLSLTessPatchAttr *Attr = getAttr(type)) return Attr->getIsInput(); return false; } bool IsHLSLOutputPatchType(QualType type) { - type = type.getCanonicalType(); if (const HLSLTessPatchAttr *Attr = getAttr(type)) return !Attr->getIsInput(); return false; } bool IsHLSLPointStreamType(QualType type) { - type = type.getCanonicalType(); if (const HLSLStreamOutputAttr *Attr = getAttr(type)) - return Attr->getVertices() == 1; + return Attr->getPrimVertices() == (unsigned)DXIL::InputPrimitive::Point; return false; } bool IsHLSLLineStreamType(QualType type) { - type = type.getCanonicalType(); if (const HLSLStreamOutputAttr *Attr = getAttr(type)) - return Attr->getVertices() == 2; + return Attr->getPrimVertices() == (unsigned)DXIL::InputPrimitive::Line; return false; } bool IsHLSLTriangleStreamType(QualType type) { - type = type.getCanonicalType(); if (const HLSLStreamOutputAttr *Attr = getAttr(type)) - return Attr->getVertices() == 3; + return Attr->getPrimVertices() == (unsigned)DXIL::InputPrimitive::Triangle; return false; } @@ -558,13 +553,13 @@ bool IsHLSLNodeType(clang::QualType type) { bool IsHLSLObjectWithImplicitMemberAccess(clang::QualType type) { if (const HLSLResourceAttr *Attr = getAttr(type)) - return Attr->getResClass() == (unsigned)DXIL::ResourceClass::CBuffer; + return DXIL::IsCTBuffer(Attr->getResKind()); return false; } bool IsHLSLObjectWithImplicitROMemberAccess(clang::QualType type) { if (const HLSLResourceAttr *Attr = getAttr(type)) - return Attr->getResClass() == (unsigned)DXIL::ResourceClass::CBuffer; + return DXIL::IsCTBuffer(Attr->getResKind()); return false; } @@ -592,7 +587,7 @@ bool IsHLSLNodeOutputType(clang::QualType type) { bool IsHLSLStructuredBufferType(clang::QualType type) { if (const HLSLResourceAttr *Attr = getAttr(type)) - return Attr->getResKind() == (unsigned)DXIL::ResourceKind::StructuredBuffer; + return Attr->getResKind() == DXIL::ResourceKind::StructuredBuffer; return false; } @@ -799,10 +794,7 @@ QualType GetHLSLResourceResultType(QualType type) { dyn_cast(RD)) { const HLSLResourceAttr *Attr = getAttr(type); - if (Attr && (Attr->getResKind() == - (unsigned)DXIL::ResourceKind::FeedbackTexture2D || - Attr->getResKind() == - (unsigned)DXIL::ResourceKind::FeedbackTexture2DArray)) { + if (Attr && DXIL::IsFeedbackTexture(Attr->getResKind())) { // Feedback textures are write-only and the data is opaque, // so there is no result type per se. return {}; diff --git a/tools/clang/lib/Sema/SemaDXR.cpp b/tools/clang/lib/Sema/SemaDXR.cpp index d71dc2be4c..73ea9dd93c 100644 --- a/tools/clang/lib/Sema/SemaDXR.cpp +++ b/tools/clang/lib/Sema/SemaDXR.cpp @@ -812,7 +812,7 @@ void DiagnoseTraceCall(Sema &S, const VarDecl *Payload, if (ContainsLongVector(Payload->getType())) { S.Diag(Payload->getLocation(), diag::err_hlsl_unsupported_long_vector) - << DXIL::kDefaultMaxVectorLength << "payload parameters"; + << "payload parameters"; return; } diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index 8abad632a2..a7d38dc1a6 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -942,11 +942,6 @@ GetOrCreateVectorSpecialization(ASTContext &context, Sema *sema, "otherwise vector handle cannot be looked up"); #endif - // I don't think this is necessary. - CXXRecordDecl *Decl = vectorSpecializationType->getAsCXXRecordDecl(); - if (GetHLSLVecSize(vectorSpecializationType) > DXIL::kDefaultMaxVectorLength) - Decl->setHasHLSLLongVector(); - return vectorSpecializationType; } @@ -3610,9 +3605,9 @@ class HLSLExternalSource : public ExternalSemaSource { break; } } else if (kind == AR_OBJECT_CONSTANT_BUFFER) { - recordDecl = DeclareConstantBufferViewType(*m_context, /*bTBuf*/ false); + recordDecl = DeclareConstantBufferViewType(*m_context, Attr); } else if (kind == AR_OBJECT_TEXTURE_BUFFER) { - recordDecl = DeclareConstantBufferViewType(*m_context, /*bTBuf*/ true); + recordDecl = DeclareConstantBufferViewType(*m_context, Attr); } else if (kind == AR_OBJECT_RAY_QUERY) { recordDecl = DeclareRayQueryType(*m_context); } else if (kind == AR_OBJECT_HEAP_RESOURCE) { @@ -4760,7 +4755,7 @@ class HLSLExternalSource : public ExternalSemaSource { return true; case AR_OBJECT_TEXTURE_BUFFER: ResKind = DXIL::ResourceKind::TBuffer; - ResClass = DXIL::ResourceClass::CBuffer; + ResClass = DXIL::ResourceClass::SRV; return true; case AR_OBJECT_FEEDBACKTEXTURE2D: ResKind = DXIL::ResourceKind::FeedbackTexture2D; @@ -5219,7 +5214,7 @@ class HLSLExternalSource : public ExternalSemaSource { MaxLength = m_sema->getLangOpts().MaxHLSLVectorLength; if (!sintValue.isStrictlyPositive() || sintValue.getLimitedValue() > MaxLength) { - m_sema->Diag(diagLoc, diag::err_hlsl_invalid_range_1_plus) << MaxLength; + m_sema->Diag(diagLoc, diag::err_hlsl_invalid_range_1_to_max) << MaxLength; return true; } @@ -5245,7 +5240,7 @@ class HLSLExternalSource : public ExternalSemaSource { HLSLResourceAttr *ResAttr = Template->getTemplatedDecl()->getAttr(); if (ResAttr && - ResAttr->getResClass() == (unsigned)DXIL::ResourceClass::CBuffer) { + DXIL::IsCTBuffer(ResAttr->getResKind())) { if (TemplateArgList.size() == 1) { const TemplateArgumentLoc &argLoc = TemplateArgList[0]; const TemplateArgument &arg = argLoc.getArgument(); @@ -5265,7 +5260,7 @@ class HLSLExternalSource : public ExternalSemaSource { if (ContainsLongVector(argType)) { m_sema->Diag(argSrcLoc, diag::err_hlsl_unsupported_long_vector) - << DXIL::kDefaultMaxVectorLength << "cbuffers"; + << "ConstantBuffers or TextureBuffers"; return true; } } @@ -5340,7 +5335,7 @@ class HLSLExternalSource : public ExternalSemaSource { if (ContainsLongVector(arg.getAsType())) { m_sema->Diag(argLoc.getLocation(), diag::err_hlsl_unsupported_long_vector) - << DXIL::kDefaultMaxVectorLength << "tessellation patches"; + << "tessellation patches"; return true; } } else if (Template->getTemplatedDecl()->hasAttr()) { @@ -5358,7 +5353,7 @@ class HLSLExternalSource : public ExternalSemaSource { if (ContainsLongVector(arg.getAsType())) { m_sema->Diag(argLoc.getLocation(), diag::err_hlsl_unsupported_long_vector) - << DXIL::kDefaultMaxVectorLength << "geometry streams"; + << "geometry streams"; return true; } } @@ -5382,7 +5377,7 @@ class HLSLExternalSource : public ExternalSemaSource { // NOTE: IsValidTemplateArgumentType emits its own diagnostics return true; } - if (ResAttr && IsTyped((DXIL::ResourceKind)ResAttr->getResKind())) { + if (ResAttr && IsTyped(ResAttr->getResKind())) { // Check vectors for being too large. if (IsVectorType(m_sema, argType)) { unsigned NumElt = hlsl::GetElementCount(argType); @@ -11626,7 +11621,7 @@ bool hlsl::DiagnoseNodeStructArgument(Sema *self, TemplateArgumentLoc ArgLoc, case AR_TOBJ_VECTOR: if (GetHLSLVecSize(ArgTy) > DXIL::kDefaultMaxVectorLength) { self->Diag(ArgLoc.getLocation(), diag::err_hlsl_unsupported_long_vector) - << DXIL::kDefaultMaxVectorLength << "node records"; + << "node records"; Empty = false; return false; } @@ -14750,7 +14745,7 @@ bool Sema::DiagnoseHLSLDecl(Declarator &D, DeclContext *DC, Expr *BitWidth, RequireCompleteType(D.getLocStart(), qt, SD); if (ContainsLongVector(qt)) { Diag(D.getLocStart(), diag::err_hlsl_unsupported_long_vector) - << DXIL::kDefaultMaxVectorLength << "cbuffers"; + << "cbuffers or tbuffers"; result = false; } } @@ -15647,7 +15642,7 @@ static bool isRelatedDeclMarkedNointerpolation(Expr *E) { static bool CheckUDTIntrinsicArg(Sema *S, Expr *Arg) { if (ContainsLongVector(Arg->getType())) { S->Diag(Arg->getExprLoc(), diag::err_hlsl_unsupported_long_vector) - << DXIL::kDefaultMaxVectorLength << "user-defined struct parameter"; + << "user-defined struct parameter"; return true; } return false; @@ -16385,15 +16380,16 @@ void DiagnoseEntry(Sema &S, FunctionDecl *FD) { // Check general parameter characteristics // Would be nice to check for resources here as they crash the compiler now. + // See issue #7186. for (const auto *param : FD->params()) { if (ContainsLongVector(param->getType())) S.Diag(param->getLocation(), diag::err_hlsl_unsupported_long_vector) - << DXIL::kDefaultMaxVectorLength << "entry function parameters"; + << "entry function parameters"; } if (ContainsLongVector(FD->getReturnType())) S.Diag(FD->getLocation(), diag::err_hlsl_unsupported_long_vector) - << DXIL::kDefaultMaxVectorLength << "entry function return type"; + << "entry function return type"; DXIL::ShaderKind Stage = ShaderModel::KindFromFullName(shaderAttr->getStage()); diff --git a/tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp b/tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp index 2275c48114..a11f72b306 100644 --- a/tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp +++ b/tools/clang/lib/Sema/SemaHLSLDiagnoseTU.cpp @@ -524,13 +524,11 @@ void hlsl::DiagnoseTranslationUnit(clang::Sema *self) { if (ContainsLongVector(param->getType())) self->Diag(param->getLocation(), diag::err_hlsl_unsupported_long_vector) - << DXIL::kDefaultMaxVectorLength << "patch constant function parameters"; if (ContainsLongVector(pPatchFnDecl->getReturnType())) self->Diag(pPatchFnDecl->getLocation(), diag::err_hlsl_unsupported_long_vector) - << DXIL::kDefaultMaxVectorLength << "patch constant function return type"; } diff --git a/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls.hlsl b/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls.hlsl index 2d0f800121..142eb59f87 100644 --- a/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls.hlsl +++ b/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls.hlsl @@ -27,27 +27,27 @@ struct LongVecTpl { vector vec; }; -vector global_vec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} -vector global_vec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} -TYPE global_vec_rec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} -TYPE global_vec_rec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} +vector global_vec; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} +vector global_vec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} +TYPE global_vec_rec; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} +TYPE global_vec_rec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} cbuffer BadBuffy { - vector cb_vec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} - vector cb_vec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} - TYPE cb_vec_rec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} - TYPE cb_vec_rec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} + vector cb_vec; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} + vector cb_vec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} + TYPE cb_vec_rec; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} + TYPE cb_vec_rec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} }; tbuffer BadTuffy { - vector tb_vec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} - vector tb_vec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} - TYPE tb_vec_rec; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} - TYPE tb_vec_rec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} + vector tb_vec; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} + vector tb_vec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} + TYPE tb_vec_rec; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} + TYPE tb_vec_rec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} }; -ConstantBuffer< TYPE > const_buf; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} -TextureBuffer< TYPE > tex_buf; // expected-error{{Vectors of over 4 elements in cbuffers are not supported}} +ConstantBuffer< TYPE > const_buf; // expected-error{{Vectors of over 4 elements in ConstantBuffers or TextureBuffers are not supported}} +TextureBuffer< TYPE > tex_buf; // expected-error{{Vectors of over 4 elements in ConstantBuffers or TextureBuffers are not supported}} [shader("pixel")] vector main( // expected-error{{Vectors of over 4 elements in entry function return type are not supported}} diff --git a/tools/clang/test/SemaHLSL/incomplete-type.hlsl b/tools/clang/test/SemaHLSL/incomplete-type.hlsl index a2856f448e..b0d4f1da7f 100644 --- a/tools/clang/test/SemaHLSL/incomplete-type.hlsl +++ b/tools/clang/test/SemaHLSL/incomplete-type.hlsl @@ -3,19 +3,9 @@ // Tests that the compiler is well-behaved with regard to uses of incomplete types. // Regression test for GitHub #2058, which crashed in this case. -// expected-note@+8 {{forward declaration of 'S'}} expected-note@+8 {{forward declaration of 'S'}} expected-note@+8 {{forward declaration of 'S'}} -// expected-note@+7 {{forward declaration of 'S'}} expected-note@+7 {{forward declaration of 'S'}} expected-note@+7 {{forward declaration of 'S'}} -// expected-note@+6 {{forward declaration of 'S'}} expected-note@+6 {{forward declaration of 'S'}} expected-note@+6 {{forward declaration of 'S'}} -// expected-note@+5 {{forward declaration of 'S'}} expected-note@+5 {{forward declaration of 'S'}} expected-note@+5 {{forward declaration of 'S'}} -// expected-note@+4 {{forward declaration of 'S'}} expected-note@+4 {{forward declaration of 'S'}} expected-note@+4 {{forward declaration of 'S'}} -// expected-note@+3 {{forward declaration of 'S'}} expected-note@+3 {{forward declaration of 'S'}} expected-note@+3 {{forward declaration of 'S'}} -// expected-note@+2 {{forward declaration of 'S'}} expected-note@+2 {{forward declaration of 'S'}} expected-note@+2 {{forward declaration of 'S'}} -// expected-note@+1 {{forward declaration of 'S'}} expected-note@+1 {{forward declaration of 'S'}} expected-note@+1 {{forward declaration of 'S'}} -struct S; - -// expected-note@+2 {{template is declared here}} -// expected-note@+1 {{template is declared here}} expected-note@+1 {{template is declared here}} expected-note@+1 {{template is declared here}} -template struct T; + +struct S; // expected-note 24 {{forward declaration of 'S'}} +template struct T; // expected-note 4 {{template is declared here}} ConstantBuffer CB; // expected-error {{variable has incomplete type 'S'}} ConstantBuffer > TB; // expected-error {{implicit instantiation of undefined template 'T<1>'}} From eedab25273063edd04740d96174dcb8d799c44d7 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Mon, 10 Mar 2025 04:16:43 -0600 Subject: [PATCH 16/45] clang-format --- lib/DXIL/DxilUtil.cpp | 32 +++++++++++-------- tools/clang/include/clang/AST/HlslTypes.h | 5 +-- tools/clang/include/clang/Basic/Attr.td | 10 +++--- .../clang/Basic/DiagnosticSemaKinds.td | 8 ++--- tools/clang/lib/AST/ASTContextHLSL.cpp | 6 ++-- tools/clang/lib/Sema/SemaHLSL.cpp | 3 +- 6 files changed, 35 insertions(+), 29 deletions(-) diff --git a/lib/DXIL/DxilUtil.cpp b/lib/DXIL/DxilUtil.cpp index 065f19d7d0..f6ffd7f7e2 100644 --- a/lib/DXIL/DxilUtil.cpp +++ b/lib/DXIL/DxilUtil.cpp @@ -426,19 +426,21 @@ GetHLSLResourceProperties(llvm::Type *Ty) { false, false, false)); if (name == "SamplerComparisonState") - return RetType( - true, MakeResourceProperties(hlsl::DXIL::ResourceKind::Sampler, /*UAV*/ false, - /*ROV*/ false, /*cmp or counter*/ true)); + return RetType(true, MakeResourceProperties( + hlsl::DXIL::ResourceKind::Sampler, /*UAV*/ false, + /*ROV*/ false, /*cmp or counter*/ true)); if (name.startswith("AppendStructuredBuffer<")) - return RetType(true, MakeResourceProperties( - hlsl::DXIL::ResourceKind::StructuredBuffer, - /*UAV*/ true, /*ROV*/ false, /*cmp or counter*/ true)); + return RetType(true, + MakeResourceProperties( + hlsl::DXIL::ResourceKind::StructuredBuffer, + /*UAV*/ true, /*ROV*/ false, /*cmp or counter*/ true)); if (name.startswith("ConsumeStructuredBuffer<")) return RetType(true, MakeResourceProperties( hlsl::DXIL::ResourceKind::StructuredBuffer, - /*UAV*/ false, /*ROV*/ false, /*cmp or counter*/ true)); + /*UAV*/ false, /*ROV*/ false, + /*cmp or counter*/ true)); if (name == "RaytracingAccelerationStructure") return RetType(true, @@ -447,14 +449,14 @@ GetHLSLResourceProperties(llvm::Type *Ty) { /*UAV*/ false, /*ROV*/ false, false)); if (name.startswith("ConstantBuffer<")) - return RetType(true, - MakeResourceProperties(hlsl::DXIL::ResourceKind::CBuffer, - /*UAV*/ false, /*ROV*/ false, false)); + return RetType( + true, MakeResourceProperties(hlsl::DXIL::ResourceKind::CBuffer, + /*UAV*/ false, /*ROV*/ false, false)); if (name.startswith("TextureBuffer<")) - return RetType(true, - MakeResourceProperties(hlsl::DXIL::ResourceKind::TBuffer, - /*UAV*/ false, /*ROV*/ false, false)); + return RetType( + true, MakeResourceProperties(hlsl::DXIL::ResourceKind::TBuffer, + /*UAV*/ false, /*ROV*/ false, false)); if (ConsumePrefix(name, "FeedbackTexture2D")) { hlsl::DXIL::ResourceKind kind = hlsl::DXIL::ResourceKind::Invalid; @@ -464,7 +466,9 @@ GetHLSLResourceProperties(llvm::Type *Ty) { kind = hlsl::DXIL::ResourceKind::FeedbackTexture2D; if (name.startswith("<")) - return RetType(true, MakeResourceProperties(kind, /*UAV*/ false, /*ROV*/ false, /*Cmp*/ false)); + return RetType(true, + MakeResourceProperties(kind, /*UAV*/ false, + /*ROV*/ false, /*Cmp*/ false)); return FalseRet; } diff --git a/tools/clang/include/clang/AST/HlslTypes.h b/tools/clang/include/clang/AST/HlslTypes.h index 9fd09b6539..e6a50de8fb 100644 --- a/tools/clang/include/clang/AST/HlslTypes.h +++ b/tools/clang/include/clang/AST/HlslTypes.h @@ -387,8 +387,9 @@ clang::CXXRecordDecl *DeclareUIntTemplatedTypeWithHandleInDeclContext( clang::ASTContext &context, clang::DeclContext *declContext, llvm::StringRef typeName, llvm::StringRef templateParamName, clang::InheritableAttr *Attr = nullptr); -clang::CXXRecordDecl *DeclareConstantBufferViewType(clang::ASTContext &context, - clang::InheritableAttr *Attr); +clang::CXXRecordDecl * +DeclareConstantBufferViewType(clang::ASTContext &context, + clang::InheritableAttr *Attr); clang::CXXRecordDecl *DeclareRayQueryType(clang::ASTContext &context); clang::CXXRecordDecl *DeclareResourceType(clang::ASTContext &context, bool bSampler); diff --git a/tools/clang/include/clang/Basic/Attr.td b/tools/clang/include/clang/Basic/Attr.td index bbc1263e20..9e48df51fd 100644 --- a/tools/clang/include/clang/Basic/Attr.td +++ b/tools/clang/include/clang/Basic/Attr.td @@ -960,8 +960,8 @@ def HLSLTessPatch : InheritableAttr { def HLSLStreamOutput : InheritableAttr { let Spellings = []; // No spellings! - // PrimVertices are the number of vertices that make up the streamed primitive. - // Points have 1. Lines have 2. Triangles have 3. + // PrimVertices are the number of vertices that make up the streamed + // primitive. Points have 1. Lines have 2. Triangles have 3. let Args = [UnsignedArgument<"PrimVertices">]; let Subjects = SubjectList<[CXXRecord]>; let Documentation = [Undocumented]; @@ -969,13 +969,13 @@ def HLSLStreamOutput : InheritableAttr { def HLSLResource : InheritableAttr { let Spellings = []; // No spellings! - let Args = [UnsignedArgument<"ResKindUint">, UnsignedArgument<"ResClassUint">]; + let Args = [UnsignedArgument<"ResKindUint">, + UnsignedArgument<"ResClassUint">]; let Subjects = SubjectList<[CXXRecord]>; let Documentation = [Undocumented]; // Add enum typed getters for safety and brevity. - let AdditionalMembers = - [{ + let AdditionalMembers = [{ hlsl::DXIL::ResourceKind getResKind() const { return (hlsl::DXIL::ResourceKind)getResKindUint(); } diff --git a/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td b/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td index 5f6b7effce..64eebfeb0e 100644 --- a/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -7519,8 +7519,8 @@ def err_hlsl_half_load_store: Error< "LoadHalf and StoreHalf are not supported for min precision mode">; def err_hlsl_interfaces_cannot_inherit: Error< "interfaces cannot inherit from other types">; -def err_hlsl_invalid_range_1_to_max: Error< - "invalid value, valid range is between 1 and %0 inclusive">; +def err_hlsl_invalid_range_1_to_max + : Error<"invalid value, valid range is between 1 and %0 inclusive">; def err_hlsl_matrix_member_bad_format: Error< "invalid format for matrix subscript '%0'">; def err_hlsl_matrix_member_empty: Error< @@ -7851,8 +7851,8 @@ def err_hlsl_load_from_mesh_out_arrays: Error< "output arrays of a mesh shader can not be read from">; def err_hlsl_out_indices_array_incorrect_access: Error< "a vector in out indices array must be accessed as a whole">; -def err_hlsl_unsupported_long_vector: Error< - "Vectors of over 4 elements in %0 are not supported">; +def err_hlsl_unsupported_long_vector + : Error<"Vectors of over 4 elements in %0 are not supported">; def err_hlsl_logical_binop_scalar : Error< "operands for short-circuiting logical binary operator must be scalar, for non-scalar types use '%select{and|or}0'">; def err_hlsl_ternary_scalar : Error< diff --git a/tools/clang/lib/AST/ASTContextHLSL.cpp b/tools/clang/lib/AST/ASTContextHLSL.cpp index 0a64772d11..870d032d39 100644 --- a/tools/clang/lib/AST/ASTContextHLSL.cpp +++ b/tools/clang/lib/AST/ASTContextHLSL.cpp @@ -1131,7 +1131,8 @@ CXXRecordDecl *hlsl::DeclareUIntTemplatedTypeWithHandleInDeclContext( } clang::CXXRecordDecl * -hlsl::DeclareConstantBufferViewType(clang::ASTContext &context, InheritableAttr *Attr) { +hlsl::DeclareConstantBufferViewType(clang::ASTContext &context, + InheritableAttr *Attr) { // Create ConstantBufferView template declaration in translation unit scope // like other resource. // template ConstantBuffer { int h; } @@ -1141,7 +1142,8 @@ hlsl::DeclareConstantBufferViewType(clang::ASTContext &context, InheritableAttr const char *TypeName = "ConstantBuffer"; if (IsTBuffer(cast(Attr)->getResKind())) TypeName = "TextureBuffer"; - BuiltinTypeDeclBuilder typeDeclBuilder(DC, TypeName, TagDecl::TagKind::TTK_Struct); + BuiltinTypeDeclBuilder typeDeclBuilder(DC, TypeName, + TagDecl::TagKind::TTK_Struct); (void)typeDeclBuilder.addTypeTemplateParam("T"); typeDeclBuilder.startDefinition(); CXXRecordDecl *templateRecordDecl = typeDeclBuilder.getRecordDecl(); diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index a7d38dc1a6..2de7004532 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -5239,8 +5239,7 @@ class HLSLExternalSource : public ExternalSemaSource { // Allow object type for Constant/TextureBuffer. HLSLResourceAttr *ResAttr = Template->getTemplatedDecl()->getAttr(); - if (ResAttr && - DXIL::IsCTBuffer(ResAttr->getResKind())) { + if (ResAttr && DXIL::IsCTBuffer(ResAttr->getResKind())) { if (TemplateArgList.size() == 1) { const TemplateArgumentLoc &argLoc = TemplateArgList[0]; const TemplateArgument &arg = argLoc.getArgument(); From e9cf3d2b9693ca997b579c1fc1b5ab5af3df7c29 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Mon, 10 Mar 2025 04:49:24 -0600 Subject: [PATCH 17/45] Respond to feedback from a different PR --- .../clang/Basic/DiagnosticSemaKinds.td | 2 +- .../hlsl/types/invalid-longvec-decls-hs.hlsl | 6 +- .../hlsl/types/invalid-longvec-decls.hlsl | 98 +++++++++---------- 3 files changed, 53 insertions(+), 53 deletions(-) diff --git a/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td b/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td index 64eebfeb0e..9be040b8a0 100644 --- a/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -7852,7 +7852,7 @@ def err_hlsl_load_from_mesh_out_arrays: Error< def err_hlsl_out_indices_array_incorrect_access: Error< "a vector in out indices array must be accessed as a whole">; def err_hlsl_unsupported_long_vector - : Error<"Vectors of over 4 elements in %0 are not supported">; + : Error<"vectors of over 4 elements in %0 are not supported">; def err_hlsl_logical_binop_scalar : Error< "operands for short-circuiting logical binary operator must be scalar, for non-scalar types use '%select{and|or}0'">; def err_hlsl_ternary_scalar : Error< diff --git a/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls-hs.hlsl b/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls-hs.hlsl index 185233ad0f..1625454360 100644 --- a/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls-hs.hlsl +++ b/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls-hs.hlsl @@ -10,9 +10,9 @@ struct LongVec { vector vec; }; -HsConstantData PatchConstantFunction( // expected-error{{Vectors of over 4 elements in patch constant function return type are not supported}} - vector vec : V, // expected-error{{Vectors of over 4 elements in patch constant function parameters are not supported}} - LongVec lv : L) { // expected-error{{Vectors of over 4 elements in patch constant function parameters are not supported}} +HsConstantData PatchConstantFunction( // expected-error{{vectors of over 4 elements in patch constant function return type are not supported}} + vector vec : V, // expected-error{{vectors of over 4 elements in patch constant function parameters are not supported}} + LongVec lv : L) { // expected-error{{vectors of over 4 elements in patch constant function parameters are not supported}} return (HsConstantData)0; } diff --git a/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls.hlsl b/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls.hlsl index 142eb59f87..0604feeaec 100644 --- a/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls.hlsl +++ b/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-decls.hlsl @@ -27,37 +27,37 @@ struct LongVecTpl { vector vec; }; -vector global_vec; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} -vector global_vec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} -TYPE global_vec_rec; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} -TYPE global_vec_rec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} +vector global_vec; // expected-error{{vectors of over 4 elements in cbuffers or tbuffers are not supported}} +vector global_vec_arr[10]; // expected-error{{vectors of over 4 elements in cbuffers or tbuffers are not supported}} +TYPE global_vec_rec; // expected-error{{vectors of over 4 elements in cbuffers or tbuffers are not supported}} +TYPE global_vec_rec_arr[10]; // expected-error{{vectors of over 4 elements in cbuffers or tbuffers are not supported}} cbuffer BadBuffy { - vector cb_vec; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} - vector cb_vec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} - TYPE cb_vec_rec; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} - TYPE cb_vec_rec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} + vector cb_vec; // expected-error{{vectors of over 4 elements in cbuffers or tbuffers are not supported}} + vector cb_vec_arr[10]; // expected-error{{vectors of over 4 elements in cbuffers or tbuffers are not supported}} + TYPE cb_vec_rec; // expected-error{{vectors of over 4 elements in cbuffers or tbuffers are not supported}} + TYPE cb_vec_rec_arr[10]; // expected-error{{vectors of over 4 elements in cbuffers or tbuffers are not supported}} }; tbuffer BadTuffy { - vector tb_vec; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} - vector tb_vec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} - TYPE tb_vec_rec; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} - TYPE tb_vec_rec_arr[10]; // expected-error{{Vectors of over 4 elements in cbuffers or tbuffers are not supported}} + vector tb_vec; // expected-error{{vectors of over 4 elements in cbuffers or tbuffers are not supported}} + vector tb_vec_arr[10]; // expected-error{{vectors of over 4 elements in cbuffers or tbuffers are not supported}} + TYPE tb_vec_rec; // expected-error{{vectors of over 4 elements in cbuffers or tbuffers are not supported}} + TYPE tb_vec_rec_arr[10]; // expected-error{{vectors of over 4 elements in cbuffers or tbuffers are not supported}} }; -ConstantBuffer< TYPE > const_buf; // expected-error{{Vectors of over 4 elements in ConstantBuffers or TextureBuffers are not supported}} -TextureBuffer< TYPE > tex_buf; // expected-error{{Vectors of over 4 elements in ConstantBuffers or TextureBuffers are not supported}} +ConstantBuffer< TYPE > const_buf; // expected-error{{vectors of over 4 elements in ConstantBuffers or TextureBuffers are not supported}} +TextureBuffer< TYPE > tex_buf; // expected-error{{vectors of over 4 elements in ConstantBuffers or TextureBuffers are not supported}} [shader("pixel")] -vector main( // expected-error{{Vectors of over 4 elements in entry function return type are not supported}} - vector vec : V) : SV_Target { // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} +vector main( // expected-error{{vectors of over 4 elements in entry function return type are not supported}} + vector vec : V) : SV_Target { // expected-error{{vectors of over 4 elements in entry function parameters are not supported}} return vec; } [shader("vertex")] -TYPE vs_main( // expected-error{{Vectors of over 4 elements in entry function return type are not supported}} - TYPE parm : P) : SV_Target { // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} +TYPE vs_main( // expected-error{{vectors of over 4 elements in entry function return type are not supported}} + TYPE parm : P) : SV_Target { // expected-error{{vectors of over 4 elements in entry function parameters are not supported}} parm.f = 0; return parm; } @@ -65,33 +65,33 @@ TYPE vs_main( // expected-error{{Vectors of over 4 elements in entry function re [shader("geometry")] [maxvertexcount(3)] -void gs_point(line TYPE e, // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} - inout PointStream OutputStream0) {} // expected-error{{Vectors of over 4 elements in geometry streams are not supported}} +void gs_point(line TYPE e, // expected-error{{vectors of over 4 elements in entry function parameters are not supported}} + inout PointStream OutputStream0) {} // expected-error{{vectors of over 4 elements in geometry streams are not supported}} [shader("geometry")] [maxvertexcount(12)] -void gs_line(line TYPE a, // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} - inout LineStream OutputStream0) {} // expected-error{{Vectors of over 4 elements in geometry streams are not supported}} +void gs_line(line TYPE a, // expected-error{{vectors of over 4 elements in entry function parameters are not supported}} + inout LineStream OutputStream0) {} // expected-error{{vectors of over 4 elements in geometry streams are not supported}} [shader("geometry")] [maxvertexcount(12)] -void gs_line(line TYPE a, // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} - inout TriangleStream OutputStream0) {} // expected-error{{Vectors of over 4 elements in geometry streams are not supported}} +void gs_line(line TYPE a, // expected-error{{vectors of over 4 elements in entry function parameters are not supported}} + inout TriangleStream OutputStream0) {} // expected-error{{vectors of over 4 elements in geometry streams are not supported}} [shader("domain")] [domain("tri")] -void ds_main(OutputPatch TrianglePatch) {} // expected-error{{Vectors of over 4 elements in tessellation patches are not supported}} +void ds_main(OutputPatch TrianglePatch) {} // expected-error{{vectors of over 4 elements in tessellation patches are not supported}} -void patch_const(InputPatch inpatch, // expected-error{{Vectors of over 4 elements in tessellation patches are not supported}} - OutputPatch outpatch) {} // expected-error{{Vectors of over 4 elements in tessellation patches are not supported}} +void patch_const(InputPatch inpatch, // expected-error{{vectors of over 4 elements in tessellation patches are not supported}} + OutputPatch outpatch) {} // expected-error{{vectors of over 4 elements in tessellation patches are not supported}} [shader("hull")] [domain("tri")] [outputtopology("triangle_cw")] [outputcontrolpoints(32)] [patchconstantfunc("patch_const")] -void hs_main(InputPatch TrianglePatch) {} // expected-error{{Vectors of over 4 elements in tessellation patches are not supported}} +void hs_main(InputPatch TrianglePatch) {} // expected-error{{vectors of over 4 elements in tessellation patches are not supported}} RaytracingAccelerationStructure RTAS; @@ -116,42 +116,42 @@ struct [raypayload] DXRLongVecTpl { void raygen() { RTTYPE p = (RTTYPE)0; RayDesc ray = (RayDesc)0; - TraceRay(RTAS, RAY_FLAG_NONE, 0, 0, 1, 0, ray, p); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} - CallShader(0, p); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} + TraceRay(RTAS, RAY_FLAG_NONE, 0, 0, 1, 0, ray, p); // expected-error{{vectors of over 4 elements in user-defined struct parameter are not supported}} + CallShader(0, p); // expected-error{{vectors of over 4 elements in user-defined struct parameter are not supported}} } [shader("closesthit")] -void closesthit(inout RTTYPE payload, // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} - in RTTYPE attribs ) { // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} +void closesthit(inout RTTYPE payload, // expected-error{{vectors of over 4 elements in entry function parameters are not supported}} + in RTTYPE attribs ) { // expected-error{{vectors of over 4 elements in entry function parameters are not supported}} RayDesc ray; - TraceRay( RTAS, RAY_FLAG_NONE, 0xff, 0, 1, 0, ray, payload ); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} - CallShader(0, payload); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} + TraceRay( RTAS, RAY_FLAG_NONE, 0xff, 0, 1, 0, ray, payload ); // expected-error{{vectors of over 4 elements in user-defined struct parameter are not supported}} + CallShader(0, payload); // expected-error{{vectors of over 4 elements in user-defined struct parameter are not supported}} } [shader("anyhit")] -void AnyHit( inout RTTYPE payload, // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} - in RTTYPE attribs ) // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} +void AnyHit( inout RTTYPE payload, // expected-error{{vectors of over 4 elements in entry function parameters are not supported}} + in RTTYPE attribs ) // expected-error{{vectors of over 4 elements in entry function parameters are not supported}} { } [shader("miss")] -void Miss(inout RTTYPE payload){ // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} +void Miss(inout RTTYPE payload){ // expected-error{{vectors of over 4 elements in entry function parameters are not supported}} RayDesc ray; - TraceRay( RTAS, RAY_FLAG_NONE, 0xff, 0, 1, 0, ray, payload ); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} - CallShader(0, payload); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} + TraceRay( RTAS, RAY_FLAG_NONE, 0xff, 0, 1, 0, ray, payload ); // expected-error{{vectors of over 4 elements in user-defined struct parameter are not supported}} + CallShader(0, payload); // expected-error{{vectors of over 4 elements in user-defined struct parameter are not supported}} } [shader("intersection")] void Intersection() { float hitT = RayTCurrent(); RTTYPE attr = (RTTYPE)0; - bool bReported = ReportHit(hitT, 0, attr); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} + bool bReported = ReportHit(hitT, 0, attr); // expected-error{{vectors of over 4 elements in user-defined struct parameter are not supported}} } [shader("callable")] -void callable1(inout RTTYPE p) { // expected-error{{Vectors of over 4 elements in entry function parameters are not supported}} - CallShader(0, p); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} +void callable1(inout RTTYPE p) { // expected-error{{vectors of over 4 elements in entry function parameters are not supported}} + CallShader(0, p); // expected-error{{vectors of over 4 elements in user-defined struct parameter are not supported}} } groupshared LongVec as_pld; @@ -159,7 +159,7 @@ groupshared LongVec as_pld; [shader("amplification")] [numthreads(1,1,1)] void Amp() { - DispatchMesh(1,1,1,as_pld); // expected-error{{Vectors of over 4 elements in user-defined struct parameter are not supported}} + DispatchMesh(1,1,1,as_pld); // expected-error{{vectors of over 4 elements in user-defined struct parameter are not supported}} } struct NodeLongVec { @@ -183,18 +183,18 @@ struct NodeLongVecTpl { [NodeLaunch("broadcasting")] [NumThreads(8,1,1)] [NodeMaxDispatchGrid(8,1,1)] -void broadcast(DispatchNodeInputRecord input, // expected-error{{Vectors of over 4 elements in node records are not supported}} - NodeOutput output) // expected-error{{Vectors of over 4 elements in node records are not supported}} +void broadcast(DispatchNodeInputRecord input, // expected-error{{vectors of over 4 elements in node records are not supported}} + NodeOutput output) // expected-error{{vectors of over 4 elements in node records are not supported}} { - ThreadNodeOutputRecords touts; // expected-error{{Vectors of over 4 elements in node records are not supported}} - GroupNodeOutputRecords gouts; // expected-error{{Vectors of over 4 elements in node records are not supported}} + ThreadNodeOutputRecords touts; // expected-error{{vectors of over 4 elements in node records are not supported}} + GroupNodeOutputRecords gouts; // expected-error{{vectors of over 4 elements in node records are not supported}} } [Shader("node")] [NodeLaunch("coalescing")] [NumThreads(8,1,1)] -void coalesce(GroupNodeInputRecords input) {} // expected-error{{Vectors of over 4 elements in node records are not supported}} +void coalesce(GroupNodeInputRecords input) {} // expected-error{{vectors of over 4 elements in node records are not supported}} [Shader("node")] [NodeLaunch("thread")] -void threader(ThreadNodeInputRecord input) {} // expected-error{{Vectors of over 4 elements in node records are not supported}} +void threader(ThreadNodeInputRecord input) {} // expected-error{{vectors of over 4 elements in node records are not supported}} From 1602bb156e792307c66daf4a8d95c1fbc9628e1d Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Mon, 2 Dec 2024 19:14:45 -1000 Subject: [PATCH 18/45] Allow native vectors for LLVM operations Disables various forms of scalarization and vector elimination to permit vectors to pass through to final DXIL when used in native LLVM operations and loading/storing. Introduces a few vector manipulation llvm instructions to DXIL allowing for them to appear in output DXIL. Skips passes for 6.9 that scalarize, convert to arrays, or otherwise eliminate vectors. This eliminates the element-by-element loading of the vectors In many cases, this required plumbing the shader model information to passes that didn't have it before. Many changes were needed for the MatrixBitcastLower pass related to linking to avoid converting matrix vectors, but also to perform the conversion if a shader was compiled for 6.9+, but then linked to a earlier target. This now adapts to the linker target to either preserve vectors for 6.9 or arrays for previous versions. This requires running the DynamicIndexing VectorToArray pass during linking since 6_x and 6_9+ will fail to run this in the initial compile, but will still need to lower vectors to arrays. Ternary conditional/select operators were element extracted in codegen. Removing this allows 6.9 to preserve the vectors, but also maintains behavior for previous shader models because the operations get scalarized later anyway. Keep groupshared variables as vectors for 6.9. They are no longer represented as indivual groupshared scalars. Adds extensive tests for these operations using different types and sizes and testing them appropriately. Booleans produce significantly different code, so they get their own test. Fixes #7123 --- include/dxc/DXIL/DxilInstructions.h | 36 ++ lib/DxilValidation/DxilValidation.cpp | 2 + lib/HLSL/DxilLinker.cpp | 6 + lib/HLSL/HLMatrixBitcastLowerPass.cpp | 44 +- lib/Transforms/Scalar/DxilEliminateVector.cpp | 6 + lib/Transforms/Scalar/LowerTypePasses.cpp | 18 +- .../Scalar/ScalarReplAggregatesHLSL.cpp | 18 +- lib/Transforms/Scalar/Scalarizer.cpp | 6 + tools/clang/lib/CodeGen/CGExprScalar.cpp | 15 +- tools/clang/lib/Sema/SemaHLSL.cpp | 8 +- .../hlsl/types/longvec-operators-bool.hlsl | 463 +++++++++++++++++ .../hlsl/types/longvec-operators-int.hlsl | 58 +++ .../hlsl/types/longvec-operators.hlsl | 491 ++++++++++++++++++ tools/clang/unittests/HLSL/LinkerTest.cpp | 5 + utils/hct/hctdb.py | 31 ++ 15 files changed, 1165 insertions(+), 42 deletions(-) create mode 100644 tools/clang/test/CodeGenDXIL/hlsl/types/longvec-operators-bool.hlsl create mode 100644 tools/clang/test/CodeGenDXIL/hlsl/types/longvec-operators-int.hlsl create mode 100644 tools/clang/test/CodeGenDXIL/hlsl/types/longvec-operators.hlsl diff --git a/include/dxc/DXIL/DxilInstructions.h b/include/dxc/DXIL/DxilInstructions.h index 11ab8e3b8d..1523500d0c 100644 --- a/include/dxc/DXIL/DxilInstructions.h +++ b/include/dxc/DXIL/DxilInstructions.h @@ -645,6 +645,42 @@ struct LlvmInst_VAArg { bool isAllowed() const { return false; } }; +/// This instruction extracts from vector +struct LlvmInst_ExtractElement { + llvm::Instruction *Instr; + // Construction and identification + LlvmInst_ExtractElement(llvm::Instruction *pInstr) : Instr(pInstr) {} + operator bool() const { + return Instr->getOpcode() == llvm::Instruction::ExtractElement; + } + // Validation support + bool isAllowed() const { return true; } +}; + +/// This instruction inserts into vector +struct LlvmInst_InsertElement { + llvm::Instruction *Instr; + // Construction and identification + LlvmInst_InsertElement(llvm::Instruction *pInstr) : Instr(pInstr) {} + operator bool() const { + return Instr->getOpcode() == llvm::Instruction::InsertElement; + } + // Validation support + bool isAllowed() const { return true; } +}; + +/// This instruction Shuffle two vectors +struct LlvmInst_ShuffleVector { + llvm::Instruction *Instr; + // Construction and identification + LlvmInst_ShuffleVector(llvm::Instruction *pInstr) : Instr(pInstr) {} + operator bool() const { + return Instr->getOpcode() == llvm::Instruction::ShuffleVector; + } + // Validation support + bool isAllowed() const { return true; } +}; + /// This instruction extracts from aggregate struct LlvmInst_ExtractValue { llvm::Instruction *Instr; diff --git a/lib/DxilValidation/DxilValidation.cpp b/lib/DxilValidation/DxilValidation.cpp index 0a2001a745..a9c36b3b13 100644 --- a/lib/DxilValidation/DxilValidation.cpp +++ b/lib/DxilValidation/DxilValidation.cpp @@ -2193,6 +2193,8 @@ static bool ValidateType(Type *Ty, ValidationContext &ValCtx, return true; if (Ty->isVectorTy()) { + if (ValCtx.DxilMod.GetShaderModel()->IsSM69Plus()) + return true; ValCtx.EmitTypeError(Ty, ValidationRule::TypesNoVector); return false; } diff --git a/lib/HLSL/DxilLinker.cpp b/lib/HLSL/DxilLinker.cpp index 68c83fc037..ca343662ab 100644 --- a/lib/HLSL/DxilLinker.cpp +++ b/lib/HLSL/DxilLinker.cpp @@ -1255,6 +1255,12 @@ void DxilLinkJob::RunPreparePass(Module &M) { // For static global handle. PM.add(createLowerStaticGlobalIntoAlloca()); + // Change dynamic indexing vector to array where vectors aren't + // supported, but might be there from the initial compile. + if (!pSM->IsSM69Plus()) + PM.add( + createDynamicIndexingVectorToArrayPass(false /* ReplaceAllVector */)); + // Remove MultiDimArray from function call arg. PM.add(createMultiDimArrayToOneDimArrayPass()); diff --git a/lib/HLSL/HLMatrixBitcastLowerPass.cpp b/lib/HLSL/HLMatrixBitcastLowerPass.cpp index 93ba3b9816..b708293fca 100644 --- a/lib/HLSL/HLMatrixBitcastLowerPass.cpp +++ b/lib/HLSL/HLMatrixBitcastLowerPass.cpp @@ -113,13 +113,13 @@ class MatrixBitcastLowerPass : public FunctionPass { // Lower matrix first. for (BitCastInst *BCI : matCastSet) { - lowerMatrix(BCI, BCI->getOperand(0)); + lowerMatrix(DM, BCI, BCI->getOperand(0)); } return bUpdated; } private: - void lowerMatrix(Instruction *M, Value *A); + void lowerMatrix(DxilModule &DM, Instruction *M, Value *A); bool hasCallUser(Instruction *M); }; @@ -180,7 +180,8 @@ Value *CreateEltGEP(Value *A, unsigned i, Value *zeroIdx, } } // namespace -void MatrixBitcastLowerPass::lowerMatrix(Instruction *M, Value *A) { +void MatrixBitcastLowerPass::lowerMatrix(DxilModule &DM, Instruction *M, + Value *A) { for (auto it = M->user_begin(); it != M->user_end();) { User *U = *(it++); if (GetElementPtrInst *GEP = dyn_cast(U)) { @@ -193,31 +194,42 @@ void MatrixBitcastLowerPass::lowerMatrix(Instruction *M, Value *A) { SmallVector idxList(GEP->idx_begin(), GEP->idx_end()); DXASSERT(idxList.size() == 2, "else not one dim matrix array index to matrix"); - - HLMatrixType MatTy = HLMatrixType::cast(EltTy); - Value *matSize = Builder.getInt32(MatTy.getNumElements()); - idxList.back() = Builder.CreateMul(idxList.back(), matSize); + if (!DM.GetShaderModel()->IsSM69Plus()) { + HLMatrixType MatTy = HLMatrixType::cast(EltTy); + Value *matSize = Builder.getInt32(MatTy.getNumElements()); + idxList.back() = Builder.CreateMul(idxList.back(), matSize); + } Value *NewGEP = Builder.CreateGEP(A, idxList); - lowerMatrix(GEP, NewGEP); + lowerMatrix(DM, GEP, NewGEP); DXASSERT(GEP->user_empty(), "else lower matrix fail"); GEP->eraseFromParent(); } else { DXASSERT(0, "invalid GEP for matrix"); } } else if (BitCastInst *BCI = dyn_cast(U)) { - lowerMatrix(BCI, A); + lowerMatrix(DM, BCI, A); DXASSERT(BCI->user_empty(), "else lower matrix fail"); BCI->eraseFromParent(); } else if (LoadInst *LI = dyn_cast(U)) { if (VectorType *Ty = dyn_cast(LI->getType())) { IRBuilder<> Builder(LI); - Value *zeroIdx = Builder.getInt32(0); - unsigned vecSize = Ty->getNumElements(); - Value *NewVec = UndefValue::get(LI->getType()); - for (unsigned i = 0; i < vecSize; i++) { - Value *GEP = CreateEltGEP(A, i, zeroIdx, Builder); - Value *Elt = Builder.CreateLoad(GEP); - NewVec = Builder.CreateInsertElement(NewVec, Elt, i); + Value *NewVec = nullptr; + if (DM.GetShaderModel()->IsSM69Plus()) { + // Just create a replacement load using the vector pointer. + Instruction *NewLI = LI->clone(); + unsigned VecIdx = NewLI->getNumOperands() - 1; + NewLI->setOperand(VecIdx, A); + Builder.Insert(NewLI); + NewVec = NewLI; + } else { + Value *zeroIdx = Builder.getInt32(0); + unsigned vecSize = Ty->getNumElements(); + NewVec = UndefValue::get(LI->getType()); + for (unsigned i = 0; i < vecSize; i++) { + Value *GEP = CreateEltGEP(A, i, zeroIdx, Builder); + Value *Elt = Builder.CreateLoad(GEP); + NewVec = Builder.CreateInsertElement(NewVec, Elt, i); + } } LI->replaceAllUsesWith(NewVec); LI->eraseFromParent(); diff --git a/lib/Transforms/Scalar/DxilEliminateVector.cpp b/lib/Transforms/Scalar/DxilEliminateVector.cpp index 366f011dae..bb9cf43594 100644 --- a/lib/Transforms/Scalar/DxilEliminateVector.cpp +++ b/lib/Transforms/Scalar/DxilEliminateVector.cpp @@ -10,6 +10,8 @@ // // /////////////////////////////////////////////////////////////////////////////// +#include "dxc/DXIL/DxilModule.h" + #include "llvm/IR/Dominators.h" #include "llvm/IR/Instructions.h" #include "llvm/Pass.h" @@ -151,6 +153,10 @@ bool DxilEliminateVector::TryRewriteDebugInfoForVector(InsertElementInst *IE) { bool DxilEliminateVector::runOnFunction(Function &F) { + if (F.getParent()->HasDxilModule()) + if (F.getParent()->GetDxilModule().GetShaderModel()->IsSM69Plus()) + return false; + auto *DT = &getAnalysis().getDomTree(); DxilValueCache *DVC = &getAnalysis(); diff --git a/lib/Transforms/Scalar/LowerTypePasses.cpp b/lib/Transforms/Scalar/LowerTypePasses.cpp index feeb23a5da..6d6b93f951 100644 --- a/lib/Transforms/Scalar/LowerTypePasses.cpp +++ b/lib/Transforms/Scalar/LowerTypePasses.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "dxc/DXIL/DxilConstants.h" +#include "dxc/DXIL/DxilModule.h" #include "dxc/DXIL/DxilOperations.h" #include "dxc/DXIL/DxilUtil.h" #include "dxc/HLSL/HLModule.h" @@ -180,10 +181,12 @@ bool LowerTypePass::runOnModule(Module &M) { namespace { class DynamicIndexingVectorToArray : public LowerTypePass { bool ReplaceAllVectors; + bool SupportsVectors; public: explicit DynamicIndexingVectorToArray(bool ReplaceAll = false) - : LowerTypePass(ID), ReplaceAllVectors(ReplaceAll) {} + : LowerTypePass(ID), ReplaceAllVectors(ReplaceAll), + SupportsVectors(false) {} static char ID; // Pass identification, replacement for typeid void applyOptions(PassOptions O) override; void dumpConfig(raw_ostream &OS) override; @@ -194,6 +197,7 @@ class DynamicIndexingVectorToArray : public LowerTypePass { Type *lowerType(Type *Ty) override; Constant *lowerInitVal(Constant *InitVal, Type *NewTy) override; StringRef getGlobalPrefix() override { return ".v"; } + void initialize(Module &M) override; private: bool HasVectorDynamicIndexing(Value *V); @@ -207,6 +211,11 @@ class DynamicIndexingVectorToArray : public LowerTypePass { void ReplaceAddrSpaceCast(ConstantExpr *CE, Value *A, IRBuilder<> &Builder); }; +void DynamicIndexingVectorToArray::initialize(Module &M) { + if (M.HasHLModule()) + SupportsVectors = M.GetHLModule().GetShaderModel()->IsSM69Plus(); +} + void DynamicIndexingVectorToArray::applyOptions(PassOptions O) { GetPassOptionBool(O, "ReplaceAllVectors", &ReplaceAllVectors, ReplaceAllVectors); @@ -286,7 +295,7 @@ void DynamicIndexingVectorToArray::ReplaceStaticIndexingOnVector(Value *V) { StoreInst *stInst = cast(GEPUser); Value *val = stInst->getValueOperand(); Value *ldVal = Builder.CreateLoad(V); - ldVal = Builder.CreateInsertElement(ldVal, val, constIdx); + ldVal = Builder.CreateInsertElement(ldVal, val, constIdx); // UGH Builder.CreateStore(ldVal, V); stInst->eraseFromParent(); } @@ -306,8 +315,11 @@ void DynamicIndexingVectorToArray::ReplaceStaticIndexingOnVector(Value *V) { } bool DynamicIndexingVectorToArray::needToLower(Value *V) { + // Only needed where vectors aren't supported. + if (SupportsVectors) + return false; Type *Ty = V->getType()->getPointerElementType(); - if (dyn_cast(Ty)) { + if (isa(Ty)) { if (isa(V) || ReplaceAllVectors) { return true; } diff --git a/lib/Transforms/Scalar/ScalarReplAggregatesHLSL.cpp b/lib/Transforms/Scalar/ScalarReplAggregatesHLSL.cpp index 0c3e13f608..6737c9100e 100644 --- a/lib/Transforms/Scalar/ScalarReplAggregatesHLSL.cpp +++ b/lib/Transforms/Scalar/ScalarReplAggregatesHLSL.cpp @@ -1869,7 +1869,8 @@ bool SROAGlobalAndAllocas(HLModule &HLM, bool bHasDbgInfo) { // if // all its users can be transformed, then split up the aggregate into its // separate elements. - if (ShouldAttemptScalarRepl(AI) && isSafeAllocaToScalarRepl(AI)) { + if (!HLM.GetShaderModel()->IsSM69Plus() && ShouldAttemptScalarRepl(AI) && + isSafeAllocaToScalarRepl(AI)) { std::vector Elts; IRBuilder<> Builder(dxilutil::FindAllocaInsertionPt(AI)); bool hasPrecise = HLModule::HasPreciseAttributeWithMetadata(AI); @@ -1945,8 +1946,9 @@ bool SROAGlobalAndAllocas(HLModule &HLM, bool bHasDbgInfo) { continue; } - // Flat Global vector if no dynamic vector indexing. - bool bFlatVector = !hasDynamicVectorIndexing(GV); + // Flat Global vector if no dynamic vector indexing and pre-6.9. + bool bFlatVector = + !hasDynamicVectorIndexing(GV) && !HLM.GetShaderModel()->IsSM69Plus(); if (bFlatVector) { GVDbgOffset &dbgOffset = GVDbgOffsetMap[GV]; @@ -1980,10 +1982,12 @@ bool SROAGlobalAndAllocas(HLModule &HLM, bool bHasDbgInfo) { } else { // SROA_Parameter_HLSL has no access to a domtree, if one is needed, // it'll be generated - SROAed = SROA_Helper::DoScalarReplacement( - GV, Elts, Builder, bFlatVector, - // TODO: set precise. - /*hasPrecise*/ false, typeSys, DL, DeadInsts, /*DT*/ nullptr); + if (!HLM.GetShaderModel()->IsSM69Plus()) { + SROAed = SROA_Helper::DoScalarReplacement( + GV, Elts, Builder, bFlatVector, + // TODO: set precise. + /*hasPrecise*/ false, typeSys, DL, DeadInsts, /*DT*/ nullptr); + } } if (SROAed) { diff --git a/lib/Transforms/Scalar/Scalarizer.cpp b/lib/Transforms/Scalar/Scalarizer.cpp index 729771c7c7..1b07d5f14f 100644 --- a/lib/Transforms/Scalar/Scalarizer.cpp +++ b/lib/Transforms/Scalar/Scalarizer.cpp @@ -14,6 +14,8 @@ // //===----------------------------------------------------------------------===// +#include "dxc/DXIL/DxilModule.h" + #include "llvm/ADT/STLExtras.h" #include "llvm/IR/IRBuilder.h" #include "llvm/IR/InstVisitor.h" @@ -290,6 +292,10 @@ bool Scalarizer::doInitialization(Module &M) { } bool Scalarizer::runOnFunction(Function &F) { + if (F.getParent()->HasDxilModule()) + if (F.getParent()->GetDxilModule().GetShaderModel()->IsSM69Plus()) + return false; + for (Function::iterator BBI = F.begin(), BBE = F.end(); BBI != BBE; ++BBI) { BasicBlock *BB = BBI; for (BasicBlock::iterator II = BB->begin(), IE = BB->end(); II != IE;) { diff --git a/tools/clang/lib/CodeGen/CGExprScalar.cpp b/tools/clang/lib/CodeGen/CGExprScalar.cpp index 0cb993e6f4..530c791fcc 100644 --- a/tools/clang/lib/CodeGen/CGExprScalar.cpp +++ b/tools/clang/lib/CodeGen/CGExprScalar.cpp @@ -3713,20 +3713,7 @@ VisitAbstractConditionalOperator(const AbstractConditionalOperator *E) { llvm::Value *CondV = CGF.EmitScalarExpr(condExpr); llvm::Value *LHS = Visit(lhsExpr); llvm::Value *RHS = Visit(rhsExpr); - if (llvm::VectorType *VT = dyn_cast(CondV->getType())) { - llvm::VectorType *ResultVT = cast(LHS->getType()); - llvm::Value *result = llvm::UndefValue::get(ResultVT); - for (unsigned i = 0; i < VT->getNumElements(); i++) { - llvm::Value *EltCond = Builder.CreateExtractElement(CondV, i); - llvm::Value *EltL = Builder.CreateExtractElement(LHS, i); - llvm::Value *EltR = Builder.CreateExtractElement(RHS, i); - llvm::Value *EltSelect = Builder.CreateSelect(EltCond, EltL, EltR); - result = Builder.CreateInsertElement(result, EltSelect, i); - } - return result; - } else { - return Builder.CreateSelect(CondV, LHS, RHS); - } + return Builder.CreateSelect(CondV, LHS, RHS); } if (hlsl::IsHLSLMatType(E->getType())) { llvm::Value *Cond = CGF.EmitScalarExpr(condExpr); diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index 2de7004532..6356d83440 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -6667,6 +6667,9 @@ bool HLSLExternalSource::MatchArguments( } } + std::string profile = m_sema->getLangOpts().HLSLProfile; + const ShaderModel *SM = hlsl::ShaderModel::GetByName(profile.c_str()); + // Populate argTypes. for (size_t i = 0; i <= Args.size(); i++) { const HLSL_INTRINSIC_ARGUMENT *pArgument = &pIntrinsic->pArgs[i]; @@ -6837,8 +6840,9 @@ bool HLSLExternalSource::MatchArguments( } // Verify that the final results are in bounds. - CAB(uCols > 0 && uCols <= MaxVectorSize && uRows > 0 && - uRows <= MaxVectorSize, + CAB((uCols > 0 && uRows > 0 && + ((uCols <= MaxVectorSize && uRows <= MaxVectorSize) || + (SM->IsSM69Plus() && uRows == 1))), i); // Const diff --git a/tools/clang/test/CodeGenDXIL/hlsl/types/longvec-operators-bool.hlsl b/tools/clang/test/CodeGenDXIL/hlsl/types/longvec-operators-bool.hlsl new file mode 100644 index 0000000000..bb2cae6756 --- /dev/null +++ b/tools/clang/test/CodeGenDXIL/hlsl/types/longvec-operators-bool.hlsl @@ -0,0 +1,463 @@ +// RUN: %dxc -HV 2018 -T lib_6_9 -DNUM=2 %s | FileCheck %s +// RUN: %dxc -HV 2018 -T lib_6_9 -DNUM=5 %s | FileCheck %s +// RUN: %dxc -HV 2018 -T lib_6_9 -DNUM=3 %s | FileCheck %s +// RUN: %dxc -HV 2018 -T lib_6_9 -DNUM=9 %s | FileCheck %s + +// Test relevant operators on an assortment bool vector sizes with 6.9 native vectors. + +// Just a trick to capture the needed type spellings since the DXC version of FileCheck can't do that explicitly. +// Uses non vector buffer to avoid interacting with that implementation. +// CHECK: %dx.types.ResRet.[[TY:[a-z0-9]*]] = type { [[TYPE:[a-z_0-9]*]] +RWStructuredBuffer< bool > buf; + +groupshared vector gs_vec1, gs_vec2; +groupshared vector gs_vec3; + + +// A mixed-type overload to test overload resolution and mingle different vector element types in ops +// Test assignment operators. +// CHECK-LABEL: define void @"\01?assignments +export void assignments(inout vector things[10], bool scales[10]) { + + // Another trick to capture the size. + // CHECK: [[res:%[0-9]*]] = call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32 139, %dx.types.Handle %{{[^,]*}}, i32 [[NUM:[0-9]*]] + // CHECK: [[scl:%[0-9]*]] = extractvalue %dx.types.ResRet.i32 [[res]], 0 + // CHECK: [[bscl:%[0-9]*]] = icmp ne i32 [[scl]], 0 + bool scalar = buf.Load(NUM); + + // CHECK: [[add9:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 9 + // CHECK: [[vec9:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add9]] + // CHECK: [[bvec9:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec9]], zeroinitializer + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 0 + // CHECK: [[res0:%[0-9]*]] = zext <[[NUM]] x i1> [[bvec9]] to <[[NUM]] x i32> + // CHECK: store <[[NUM]] x i32> [[res0]], <[[NUM]] x i32>* [[add0]] + things[0] = things[9]; + + // CHECK: [[spt:%[0-9]*]] = insertelement <[[NUM]] x i1> undef, i1 [[bscl]], i32 0 + // CHECK: [[res:%[0-9]*]] = shufflevector <[[NUM]] x i1> [[spt]], <[[NUM]] x i1> undef, <[[NUM]] x i32> zeroinitializer + // CHECK: [[add5:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 5 + // CHECK: [[res5:%[0-9]*]] = zext <[[NUM]] x i1> [[res]] to <[[NUM]] x i32> + // CHECK: store <[[NUM]] x i32> [[res5]], <[[NUM]] x i32>* [[add5]] + things[5] = scalar; + +} + +// Test arithmetic operators. +// CHECK-LABEL: define void @"\01?arithmetic +export vector arithmetic(inout vector things[10])[10] { + vector res[10]; + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 0 + // CHECK: [[vec0:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add0]] + // CHECK: [[add1:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 1 + // CHECK: [[vec1:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add1]] + // CHECK: [[add2:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 2 + // CHECK: [[vec2:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add2]] + // CHECK: [[add3:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 3 + // CHECK: [[vec3:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add3]] + // CHECK: [[add4:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 4 + // CHECK: [[vec4:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add4]] + // CHECK: [[add5:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 5 + // CHECK: [[vec5:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add5]] + // CHECK: [[add6:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 6 + // CHECK: [[vec6:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add6]] + + // CHECK: [[bvec0:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec0]], zeroinitializer + // CHECK: [[svec0:%[0-9]*]] = sext <[[NUM]] x i1> [[bvec0]] to <[[NUM]] x i32> + // CHECK: [[bsvec0:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[svec0]], zeroinitializer + // CHECK: [[res0:%[0-9]*]] = zext <[[NUM]] x i1> [[bsvec0]] to <[[NUM]] x i32> + res[0] = -things[0]; + + // CHECK: [[vec0:%[0-9]*]] = zext <[[NUM]] x i1> [[bvec0]] to <[[NUM]] x i32> + // CHECK: [[bvec0:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec0]], zeroinitializer + // CHECK: [[res1:%[0-9]*]] = zext <[[NUM]] x i1> [[bvec0]] to <[[NUM]] x i32> + res[1] = +things[0]; + + // CHECK: [[bvec1:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec1]], zeroinitializer + // CHECK: [[vec1:%[0-9]*]] = zext <[[NUM]] x i1> [[bvec1]] to <[[NUM]] x i32> + // CHECK: [[bvec2:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec2]], zeroinitializer + // CHECK: [[vec2:%[0-9]*]] = zext <[[NUM]] x i1> [[bvec2]] to <[[NUM]] x i32> + // CHECK: [[res2:%[0-9]*]] = add nuw nsw <[[NUM]] x i32> [[vec2]], [[vec1]] + // CHECK: [[bres2:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[res2]], zeroinitializer + // CHECK: [[res2:%[0-9][0-9]*]] = zext <[[NUM]] x i1> [[bres2]] to <[[NUM]] x i32> + res[2] = things[1] + things[2]; + + // CHECK: [[bvec3:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec3]], zeroinitializer + // CHECK: [[vec3:%[0-9]*]] = zext <[[NUM]] x i1> [[bvec3]] to <[[NUM]] x i32> + // CHECK: [[res3:%[0-9]*]] = sub nsw <[[NUM]] x i32> [[vec2]], [[vec3]] + // CHECK: [[bres3:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[res3]], zeroinitializer + // CHECK: [[res3:%[0-9][0-9]*]] = zext <[[NUM]] x i1> [[bres3]] to <[[NUM]] x i32> + res[3] = things[2] - things[3]; + + // CHECK: [[bvec4:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec4]], zeroinitializer + // CHECK: [[vec4:%[0-9]*]] = zext <[[NUM]] x i1> [[bvec4]] to <[[NUM]] x i32> + // CHECK: [[res4:%[0-9]*]] = mul nuw nsw <[[NUM]] x i32> [[vec4]], [[vec3]] + // CHECK: [[bres4:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[res4]], zeroinitializer + // CHECK: [[res4:%[0-9][0-9]*]] = zext <[[NUM]] x i1> [[bres4]] to <[[NUM]] x i32> + res[4] = things[3] * things[4]; + + // CHECK: [[bvec5:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec5]], zeroinitializer + // CHECK: [[vec5:%[0-9]*]] = zext <[[NUM]] x i1> [[bvec5]] to <[[NUM]] x i32> + // CHECK: [[res5:%[0-9]*]] = sdiv <[[NUM]] x i32> [[vec4]], [[vec5]] + // CHECK: [[bres5:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[res5]], zeroinitializer + // CHECK: [[res5:%[0-9][0-9]*]] = zext <[[NUM]] x i1> [[bres5]] to <[[NUM]] x i32> + res[5] = things[4] / things[5]; + + // CHECK: [[bvec6:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec6]], zeroinitializer + // CHECK: [[vec6:%[0-9]*]] = zext <[[NUM]] x i1> [[bvec6]] to <[[NUM]] x i32> + // CHECK: [[res6:%[0-9]*]] = {{[ufs]?rem( fast)?}} <[[NUM]] x i32> [[vec5]], [[vec6]] + res[6] = things[5] % things[6]; + + // Stores into res[]. Previous were for things[] inout. + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 0 + // CHECK: store <[[NUM]] x i32> [[res0]], <[[NUM]] x i32>* [[add0]] + // CHECK: [[add1:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 1 + // CHECK: store <[[NUM]] x i32> [[res1]], <[[NUM]] x i32>* [[add1]] + // CHECK: [[add2:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 2 + // CHECK: store <[[NUM]] x i32> [[res2]], <[[NUM]] x i32>* [[add2]] + // CHECK: [[add3:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 3 + // CHECK: store <[[NUM]] x i32> [[res3]], <[[NUM]] x i32>* [[add3]] + // CHECK: [[add4:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 4 + // CHECK: store <[[NUM]] x i32> [[res4]], <[[NUM]] x i32>* [[add4]] + // CHECK: [[add5:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 5 + // CHECK: store <[[NUM]] x i32> [[res5]], <[[NUM]] x i32>* [[add5]] + // CHECK: ret void + + + return res; +} + +// Test arithmetic operators with scalars. +// CHECK-LABEL: define void @"\01?scarithmetic +export vector scarithmetic(inout vector things[10], bool scales[10])[10] { + vector res[10]; + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 0 + // CHECK: [[vec0:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add0]] + // CHECK: [[add1:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 1 + // CHECK: [[vec1:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add1]] + // CHECK: [[add2:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 2 + // CHECK: [[vec2:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add2]] + // CHECK: [[add3:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 3 + // CHECK: [[vec3:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add3]] + // CHECK: [[add4:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 4 + // CHECK: [[vec4:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add4]] + // CHECK: [[add5:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 5 + // CHECK: [[vec5:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add5]] + // CHECK: [[add6:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 6 + // CHECK: [[vec6:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add6]] + + // CHECK: [[bvec0:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec0]], zeroinitializer + // CHECK: [[vec0:%[0-9]*]] = zext <[[NUM]] x i1> [[bvec0]] to <[[NUM]] x i32> + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [10 x i32], [10 x i32]* %scales, i32 0, i32 0 + // CHECK: [[scl0:%[0-9]*]] = load i32, i32* [[add0]] + // CHECK: [[spt:%[0-9]*]] = insertelement <[[NUM]] x i32> undef, i32 [[scl0]], i32 0 + // CHECK: [[spt0:%[0-9]*]] = shufflevector <[[NUM]] x i32> [[spt]], <[[NUM]] x i32> undef, <[[NUM]] x i32> zeroinitializer + // CHECK: [[res0:%[0-9]*]] = add <[[NUM]] x i32> [[spt0]], [[vec0]] + // CHECK: [[bres0:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[res0]], zeroinitializer + // CHECK: [[res0:%[0-9]*]] = zext <[[NUM]] x i1> [[bres0]] to <[[NUM]] x i32> + res[0] = things[0] + scales[0]; + + // CHECK: [[bvec1:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec1]], zeroinitializer + // CHECK: [[vec1:%[0-9]*]] = zext <[[NUM]] x i1> [[bvec1]] to <[[NUM]] x i32> + // CHECK: [[add1:%[0-9]*]] = getelementptr inbounds [10 x i32], [10 x i32]* %scales, i32 0, i32 1 + // CHECK: [[scl1:%[0-9]*]] = load i32, i32* [[add1]] + // CHECK: [[spt:%[0-9]*]] = insertelement <[[NUM]] x i32> undef, i32 [[scl1]], i32 0 + // CHECK: [[spt1:%[0-9]*]] = shufflevector <[[NUM]] x i32> [[spt]], <[[NUM]] x i32> undef, <[[NUM]] x i32> zeroinitializer + // CHECK: [[res1:%[0-9]*]] = sub <[[NUM]] x i32> [[vec1]], [[spt1]] + // CHECK: [[bres1:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[res1]], zeroinitializer + // CHECK: [[res1:%[0-9]*]] = zext <[[NUM]] x i1> [[bres1]] to <[[NUM]] x i32> + res[1] = things[1] - scales[1]; + + + // CHECK: [[bvec2:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec2]], zeroinitializer + // CHECK: [[vec2:%[0-9]*]] = zext <[[NUM]] x i1> [[bvec2]] to <[[NUM]] x i32> + // CHECK: [[add2:%[0-9]*]] = getelementptr inbounds [10 x i32], [10 x i32]* %scales, i32 0, i32 2 + // CHECK: [[scl2:%[0-9]*]] = load i32, i32* [[add2]] + // CHECK: [[spt:%[0-9]*]] = insertelement <[[NUM]] x i32> undef, i32 [[scl2]], i32 0 + // CHECK: [[spt2:%[0-9]*]] = shufflevector <[[NUM]] x i32> [[spt]], <[[NUM]] x i32> undef, <[[NUM]] x i32> zeroinitializer + // CHECK: [[res2:%[0-9]*]] = mul nuw <[[NUM]] x i32> [[spt2]], [[vec2]] + // CHECK: [[bres2:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[res2]], zeroinitializer + // CHECK: [[res2:%[0-9]*]] = zext <[[NUM]] x i1> [[bres2]] to <[[NUM]] x i32> + res[2] = things[2] * scales[2]; + + // CHECK: [[bvec3:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec3]], zeroinitializer + // CHECK: [[vec3:%[0-9]*]] = zext <[[NUM]] x i1> [[bvec3]] to <[[NUM]] x i32> + // CHECK: [[add3:%[0-9]*]] = getelementptr inbounds [10 x i32], [10 x i32]* %scales, i32 0, i32 3 + // CHECK: [[scl3:%[0-9]*]] = load i32, i32* [[add3]] + // CHECK: [[spt:%[0-9]*]] = insertelement <[[NUM]] x i32> undef, i32 [[scl3]], i32 0 + // CHECK: [[spt3:%[0-9]*]] = shufflevector <[[NUM]] x i32> [[spt]], <[[NUM]] x i32> undef, <[[NUM]] x i32> zeroinitializer + // CHECK: [[res3:%[0-9]*]] = sdiv <[[NUM]] x i32> [[vec3]], [[spt3]] + // CHECK: [[bres3:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[res3]], zeroinitializer + // CHECK: [[res3:%[0-9]*]] = zext <[[NUM]] x i1> [[bres3]] to <[[NUM]] x i32> + res[3] = things[3] / scales[3]; + + // CHECK: [[add4:%[0-9]*]] = getelementptr inbounds [10 x i32], [10 x i32]* %scales, i32 0, i32 4 + // CHECK: [[scl4:%[0-9]*]] = load i32, i32* [[add4]] + // CHECK: [[spt:%[0-9]*]] = insertelement <[[NUM]] x i32> undef, i32 [[scl4]], i32 0 + // CHECK: [[spt4:%[0-9]*]] = shufflevector <[[NUM]] x i32> [[spt]], <[[NUM]] x i32> undef, <[[NUM]] x i32> zeroinitializer + // CHECK: [[bvec4:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec4]], zeroinitializer + // CHECK: [[vec4:%[0-9]*]] = zext <[[NUM]] x i1> [[bvec4]] to <[[NUM]] x i32> + // CHECK: [[res4:%[0-9]*]] = add <[[NUM]] x i32> [[spt4]], [[vec4]] + // CHECK: [[bres4:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[res4]], zeroinitializer + // CHECK: [[res4:%[0-9]*]] = zext <[[NUM]] x i1> [[bres4]] to <[[NUM]] x i32> + res[4] = scales[4] + things[4]; + + // CHECK: [[add5:%[0-9]*]] = getelementptr inbounds [10 x i32], [10 x i32]* %scales, i32 0, i32 5 + // CHECK: [[scl5:%[0-9]*]] = load i32, i32* [[add5]] + // CHECK: [[spt:%[0-9]*]] = insertelement <[[NUM]] x i32> undef, i32 [[scl5]], i32 0 + // CHECK: [[spt5:%[0-9]*]] = shufflevector <[[NUM]] x i32> [[spt]], <[[NUM]] x i32> undef, <[[NUM]] x i32> zeroinitializer + // CHECK: [[bvec5:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec5]], zeroinitializer + // CHECK: [[vec5:%[0-9]*]] = zext <[[NUM]] x i1> [[bvec5]] to <[[NUM]] x i32> + // CHECK: [[res5:%[0-9]*]] = sub <[[NUM]] x i32> [[spt5]], [[vec5]] + // CHECK: [[bres5:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[res5]], zeroinitializer + // CHECK: [[res5:%[0-9]*]] = zext <[[NUM]] x i1> [[bres5]] to <[[NUM]] x i32> + res[5] = scales[5] - things[5]; + + // CHECK: [[add6:%[0-9]*]] = getelementptr inbounds [10 x i32], [10 x i32]* %scales, i32 0, i32 6 + // CHECK: [[scl6:%[0-9]*]] = load i32, i32* [[add6]] + // CHECK: [[spt:%[0-9]*]] = insertelement <[[NUM]] x i32> undef, i32 [[scl6]], i32 0 + // CHECK: [[spt6:%[0-9]*]] = shufflevector <[[NUM]] x i32> [[spt]], <[[NUM]] x i32> undef, <[[NUM]] x i32> zeroinitializer + // CHECK: [[bvec6:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec6]], zeroinitializer + // CHECK: [[vec6:%[0-9]*]] = zext <[[NUM]] x i1> [[bvec6]] to <[[NUM]] x i32> + // CHECK: [[res6:%[0-9]*]] = mul nuw <[[NUM]] x i32> [[spt6]], [[vec6]] + // CHECK: [[bres6:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[res6]], zeroinitializer + // CHECK: [[res6:%[0-9]*]] = zext <[[NUM]] x i1> [[bres6]] to <[[NUM]] x i32> + res[6] = scales[6] * things[6]; + + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 0 + // CHECK: store <[[NUM]] x i32> [[res0]], <[[NUM]] x i32>* [[add0]] + // CHECK: [[add1:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 1 + // CHECK: store <[[NUM]] x i32> [[res1]], <[[NUM]] x i32>* [[add1]] + // CHECK: [[add2:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 2 + // CHECK: store <[[NUM]] x i32> [[res2]], <[[NUM]] x i32>* [[add2]] + // CHECK: [[add3:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 3 + // CHECK: store <[[NUM]] x i32> [[res3]], <[[NUM]] x i32>* [[add3]] + // CHECK: [[add4:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 4 + // CHECK: store <[[NUM]] x i32> [[res4]], <[[NUM]] x i32>* [[add4]] + // CHECK: [[add5:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 5 + // CHECK: store <[[NUM]] x i32> [[res5]], <[[NUM]] x i32>* [[add5]] + // CHECK: [[add6:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 6 + // CHECK: store <[[NUM]] x i32> [[res6]], <[[NUM]] x i32>* [[add6]] + // CHECK: ret void + + + return res; +} + +// Test logic operators. +// Only permissable in pre-HLSL2021 +// CHECK-LABEL: define void @"\01?logic +export vector logic(vector truth[10], vector consequences[10])[10] { + vector res[10]; + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %truth, i32 0, i32 0 + // CHECK: [[vec0:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add0]] + // CHECK: [[cmp:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec0]], zeroinitializer + // CHECK: [[cmp0:%[0-9]*]] = icmp eq <[[NUM]] x i1> [[cmp]], zeroinitializer + // CHECK: [[res0:%[0-9]*]] = zext <[[NUM]] x i1> [[cmp0]] to <[[NUM]] x i32> + res[0] = !truth[0]; + + // CHECK: [[add1:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %truth, i32 0, i32 1 + // CHECK: [[vec1:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add1]] + // CHECK: [[bvec1:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec1]], zeroinitializer + // CHECK: [[add2:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %truth, i32 0, i32 2 + // CHECK: [[vec2:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add2]] + // CHECK: [[bvec2:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec2]], zeroinitializer + // CHECK: [[bres1:%[0-9]*]] = or <[[NUM]] x i1> [[bvec2]], [[bvec1]] + // CHECK: [[res1:%[0-9]*]] = zext <[[NUM]] x i1> [[bres1]] to <[[NUM]] x i32> + res[1] = truth[1] || truth[2]; + + // CHECK: [[add3:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %truth, i32 0, i32 3 + // CHECK: [[vec3:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add3]] + // CHECK: [[bvec3:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec3]], zeroinitializer + // CHECK: [[bres2:%[0-9]*]] = and <[[NUM]] x i1> [[bvec3]], [[bvec2]] + // CHECK: [[res2:%[0-9]*]] = zext <[[NUM]] x i1> [[bres2]] to <[[NUM]] x i32> + res[2] = truth[2] && truth[3]; + + // CHECK: [[add4:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %truth, i32 0, i32 4 + // CHECK: [[vec4:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add4]] + // CHECK: [[bvec4:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec4]], zeroinitializer + // CHECK: [[add5:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %truth, i32 0, i32 5 + // CHECK: [[vec5:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add5]] + // CHECK: [[bvec5:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec5]], zeroinitializer + // MORE STUFF + + res[3] = truth[3] ? truth[4] : truth[5]; + + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %consequences, i32 0, i32 0 + // CHECK: [[vec0:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add0]] + // CHECK: [[bvec0:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec0]], zeroinitializer + + // CHECK: [[add1:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %consequences, i32 0, i32 1 + // CHECK: [[vec1:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add1]] + // CHECK: [[bvec1:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec1]], zeroinitializer + // CHECK: [[bres4:%[0-9]*]] = icmp eq <[[NUM]] x i1> [[bvec0]], [[bvec1]] + // CHECK: [[res4:%[0-9]*]] = zext <[[NUM]] x i1> [[bres4]] to <[[NUM]] x i32> + res[4] = consequences[0] == consequences[1]; + + // CHECK: [[add2:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %consequences, i32 0, i32 2 + // CHECK: [[vec2:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add2]] + // CHECK: [[bvec2:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec2]], zeroinitializer + // CHECK: [[bres5:%[0-9]*]] = icmp {{u?}}ne <[[NUM]] x i1> [[bvec1]], [[bvec2]] + // CHECK: [[res5:%[0-9]*]] = zext <[[NUM]] x i1> [[bres5]] to <[[NUM]] x i32> + res[5] = consequences[1] != consequences[2]; + + // CHECK: [[add3:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %consequences, i32 0, i32 3 + // CHECK: [[vec3:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add3]] + // CHECK: [[bvec3:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec3]], zeroinitializer + // CHECK: [[bres6:%[0-9]*]] = icmp {{[osu]?}}lt <[[NUM]] x i1> [[bvec2]], [[bvec3]] + // CHECK: [[res6:%[0-9]*]] = zext <[[NUM]] x i1> [[bres6]] to <[[NUM]] x i32> + res[6] = consequences[2] < consequences[3]; + + // CHECK: [[add4:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %consequences, i32 0, i32 4 + // CHECK: [[vec4:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add4]] + // CHECK: [[bvec4:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec4]], zeroinitializer + // CHECK: [[bres7:%[0-9]*]] = icmp {{[osu]]?}}gt <[[NUM]] x i1> [[bvec3]], [[bvec4]] + // CHECK: [[res7:%[0-9]*]] = zext <[[NUM]] x i1> [[bres7]] to <[[NUM]] x i32> + res[7] = consequences[3] > consequences[4]; + + // CHECK: [[add5:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %consequences, i32 0, i32 5 + // CHECK: [[vec5:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add5]] + // CHECK: [[bvec5:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec5]], zeroinitializer + // CHECK: [[bres8:%[0-9]*]] = icmp {{[osu]]?}}le <[[NUM]] x i1> [[bvec4]], [[bvec5]] + // CHECK: [[res8:%[0-9]*]] = zext <[[NUM]] x i1> [[bres8]] to <[[NUM]] x i32> + res[8] = consequences[4] <= consequences[5]; + + // CHECK: [[add6:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %consequences, i32 0, i32 6 + // CHECK: [[vec6:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add6]] + // CHECK: [[bvec6:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec6]], zeroinitializer + // CHECK: [[bres9:%[0-9]*]] = icmp {{[osu]?}}ge <[[NUM]] x i1> [[bvec5]], [[bvec6]] + // CHECK: [[res9:%[0-9]*]] = zext <[[NUM]] x i1> [[bres9]] to <[[NUM]] x i32> + res[9] = consequences[5] >= consequences[6]; + + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 0 + // CHECK: store <[[NUM]] x i32> [[res0]], <[[NUM]] x i32>* [[add0]] + // CHECK: [[add4:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 4 + // CHECK: store <[[NUM]] x i32> [[res4]], <[[NUM]] x i32>* [[add4]] + // CHECK: [[add5:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 5 + // CHECK: store <[[NUM]] x i32> [[res5]], <[[NUM]] x i32>* [[add5]] + // CHECK: [[add6:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 6 + // CHECK: store <[[NUM]] x i32> [[res6]], <[[NUM]] x i32>* [[add6]] + // CHECK: [[add7:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 7 + // CHECK: store <[[NUM]] x i32> [[res7]], <[[NUM]] x i32>* [[add7]] + // CHECK: [[add8:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 8 + // CHECK: store <[[NUM]] x i32> [[res8]], <[[NUM]] x i32>* [[add8]] + // CHECK: [[add9:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 9 + // CHECK: store <[[NUM]] x i32> [[res9]], <[[NUM]] x i32>* [[add9]] + // CHECK: ret void + + return res; +} + +static const int Ix = 2; + +// Test indexing operators +// CHECK-LABEL: define void @"\01?index +export vector index(vector things[10], int i, bool val)[10] { + vector res[10]; + + // CHECK: [[res:%[0-9]*]] = alloca [10 x <[[NUM]] x i32>] + // CHECK: [[res0:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* [[res]], i32 0, i32 0 + // CHECK: store <[[NUM]] x i32> zeroinitializer, <[[NUM]] x i32>* [[res0]] + res[0] = 0; + + // CHECK: [[resi:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* [[res]], i32 0, i32 %i + // CHECK: store <[[NUM]] x i32> , <[[NUM]] x i32>* [[resi]] + res[i] = 1; + + // CHECK: [[res2:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* [[res]], i32 0, i32 2 + // CHECK: store <[[NUM]] x i32> , <[[NUM]] x i32>* [[res2]] + res[Ix] = true; + + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 0 + // CHECK: [[thg0:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add0]] + // CHECK: [[bthg0:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[thg0]], zeroinitializer + // CHECK: [[res3:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* [[res]], i32 0, i32 3 + // CHECK: [[thg0:%[0-9]*]] = zext <[[NUM]] x i1> [[bthg0]] to <[[NUM]] x i32> + // CHECK: store <[[NUM]] x i32> [[thg0]], <[[NUM]] x i32>* [[res3]] + res[3] = things[0]; + + // CHECK: [[addi:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 %i + // CHECK: [[thgi:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[addi]] + // CHECK: [[bthgi:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[thgi]], zeroinitializer + // CHECK: [[res4:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* [[res]], i32 0, i32 4 + // CHECK: [[thgi:%[0-9]*]] = zext <[[NUM]] x i1> [[bthgi]] to <[[NUM]] x i32> + // CHECK: store <[[NUM]] x i32> [[thgi]], <[[NUM]] x i32>* [[res4]] + res[4] = things[i]; + + // CHECK: [[add2:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 2 + // CHECK: [[thg2:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add2]] + // CHECK: [[bthg2:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[thg2]], zeroinitializer + // CHECK: [[res5:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* [[res]], i32 0, i32 5 + // CHECK: [[thg2:%[0-9]*]] = zext <[[NUM]] x i1> [[bthg2]] to <[[NUM]] x i32> + // CHECK: store <[[NUM]] x i32> [[thg2]], <[[NUM]] x i32>* [[res5]] + res[5] = things[Ix]; + // CHECK: ret void + return res; + +} + +// Test bit twiddling operators. +// CHECK-LABEL: define void @"\01?bittwiddlers +export void bittwiddlers(inout vector things[10]) { + // CHECK: [[add2:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 2 + // CHECK: [[vec2:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add2]] + // CHECK: [[bvec2:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec2]], zeroinitializer + // CHECK: [[vec2:%[0-9]*]] = zext <[[NUM]] x i1> [[bvec2]] to <[[NUM]] x i32> + + // CHECK: [[add3:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 3 + // CHECK: [[vec3:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add3]] + // CHECK: [[bvec3:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec3]], zeroinitializer + // CHECK: [[vec3:%[0-9]*]] = zext <[[NUM]] x i1> [[bvec3]] to <[[NUM]] x i32> + // CHECK: [[res1:%[0-9]*]] = or <[[NUM]] x [[TYPE]]> [[vec3]], [[vec2]] + // CHECK: [[bres1:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[res1]], zeroinitializer + // CHECK: [[add1:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %things, i32 0, i32 1 + // CHECK: [[res1:%[0-9]*]] = zext <[[NUM]] x i1> [[bres1]] to <[[NUM]] x i32> + // CHECK: store <[[NUM]] x [[TYPE]]> [[res1]], <[[NUM]] x [[TYPE]]>* [[add1]] + things[1] = things[2] | things[3]; + + // CHECK: [[add4:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 4 + // CHECK: [[vec4:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add4]] + // CHECK: [[bvec4:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec4]], zeroinitializer + // CHECK: [[bres2:%[0-9]*]] = and <[[NUM]] x i1> [[bvec4]], [[bvec3]] + // CHECK: [[res2:%[0-9]*]] = zext <[[NUM]] x i1> [[bres2]] to <[[NUM]] x i32> + // CHECK: [[bres2:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[res2]], zeroinitializer + // CHECK: [[res2:%[0-9]*]] = zext <[[NUM]] x i1> [[bres2]] to <[[NUM]] x i32> + // CHECK: store <[[NUM]] x [[TYPE]]> [[res2]], <[[NUM]] x [[TYPE]]>* [[add2]] + things[2] = things[3] & things[4]; + + // CHECK: [[vec4:%[0-9]*]] = zext <[[NUM]] x i1> [[bvec4]] to <[[NUM]] x i32> + // CHECK: [[add5:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 5 + // CHECK: [[vec5:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add5]] + // CHECK: [[bvec5:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec5]], zeroinitializer + // CHECK: [[vec5:%[0-9]*]] = zext <[[NUM]] x i1> [[bvec5]] to <[[NUM]] x i32> + // CHECK: [[res3:%[0-9]*]] = xor <[[NUM]] x [[TYPE]]> [[vec4]], [[vec5]] + // CHECK: [[bres3:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[res3]], zeroinitializer + // CHECK: [[res3:%[0-9]*]] = zext <[[NUM]] x i1> [[bres3]] to <[[NUM]] x i32> + // CHECK: store <[[NUM]] x [[TYPE]]> [[res3]], <[[NUM]] x [[TYPE]]>* [[add3]] + things[3] = things[4] ^ things[5]; + + // CHECK: [[add6:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 6 + // CHECK: [[vec6:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add6]] + // CHECK: [[bvec6:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec6]], zeroinitializer + // CHECK: [[bres4:%[0-9]*]] = or <[[NUM]] x i1> [[bvec6]], [[bvec4]] + // CHECK: [[res4:%[0-9]*]] = zext <[[NUM]] x i1> [[bres4]] to <[[NUM]] x i32> + // CHECK: store <[[NUM]] x [[TYPE]]> [[res4]], <[[NUM]] x [[TYPE]]>* [[add4]] + things[4] |= things[6]; + + // CHECK: [[add7:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 7 + // CHECK: [[vec7:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add7]] + // CHECK: [[bvec7:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec7]], zeroinitializer + // CHECK: [[bres5:%[0-9]*]] = and <[[NUM]] x i1> [[bvec7]], [[bvec5]] + // CHECK: [[res5:%[0-9]*]] = zext <[[NUM]] x i1> [[bres5]] to <[[NUM]] x i32> + // CHECK: store <[[NUM]] x [[TYPE]]> [[res5]], <[[NUM]] x [[TYPE]]>* [[add5]] + things[5] &= things[7]; + + // CHECK: [[add8:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 8 + // CHECK: [[vec8:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add8]] + // CHECK: [[bvec8:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec8]], zeroinitializer + // CHECK: [[bres6:%[0-9]*]] = xor <[[NUM]] x i1> [[bvec6]], [[bvec8]] + // CHECK: [[res6:%[0-9]*]] = zext <[[NUM]] x i1> [[bres6]] to <[[NUM]] x i32> + // CHECK: store <[[NUM]] x [[TYPE]]> [[res6]], <[[NUM]] x [[TYPE]]>* [[add6]] + things[6] ^= things[8]; + + // CHECK: ret void +} diff --git a/tools/clang/test/CodeGenDXIL/hlsl/types/longvec-operators-int.hlsl b/tools/clang/test/CodeGenDXIL/hlsl/types/longvec-operators-int.hlsl new file mode 100644 index 0000000000..8c07f40af7 --- /dev/null +++ b/tools/clang/test/CodeGenDXIL/hlsl/types/longvec-operators-int.hlsl @@ -0,0 +1,58 @@ +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=uint -DNUM=5 %s | FileCheck %s +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=int64_t -DNUM=3 %s | FileCheck %s +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=uint16_t -DNUM=9 -enable-16bit-types %s | FileCheck %s + +// Test bitwise operators on an assortment vector sizes and integer types with 6.9 native vectors. + +// Test bit twiddling operators. +// CHECK-LABEL: define void @"\01?bittwiddlers +// CHECK-SAME: ([10 x <[[NUM:[0-9][0-9]*]] x [[TYPE:[a-z0-9]*]]>]* +export void bittwiddlers(inout vector things[10]) { + // CHECK: [[add1:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 1 + // CHECK: [[vec1:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add1]] + // CHECK: [[res1:%[0-9]*]] = xor <[[NUM]] x [[TYPE]]> [[vec1]], <[[TYPE]] -1, + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 0 + // CHECK: store <[[NUM]] x [[TYPE]]> [[res1]], <[[NUM]] x [[TYPE]]>* [[add0]] + things[0] = ~things[1]; + + // CHECK: [[add2:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 2 + // CHECK: [[vec2:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add2]] + + // CHECK: [[add3:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 3 + // CHECK: [[vec3:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add3]] + // CHECK: [[res1:%[0-9]*]] = or <[[NUM]] x [[TYPE]]> [[vec3]], [[vec2]] + // CHECK: store <[[NUM]] x [[TYPE]]> [[res1]], <[[NUM]] x [[TYPE]]>* [[add1]] + things[1] = things[2] | things[3]; + + // CHECK: [[add4:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 4 + // CHECK: [[vec4:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add4]] + // CHECK: [[res2:%[0-9]*]] = and <[[NUM]] x [[TYPE]]> [[vec4]], [[vec3]] + // CHECK: store <[[NUM]] x [[TYPE]]> [[res2]], <[[NUM]] x [[TYPE]]>* [[add2]] + things[2] = things[3] & things[4]; + + // CHECK: [[add5:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 5 + // CHECK: [[vec5:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add5]] + // CHECK: [[res3:%[0-9]*]] = xor <[[NUM]] x [[TYPE]]> [[vec4]], [[vec5]] + // CHECK: store <[[NUM]] x [[TYPE]]> [[res3]], <[[NUM]] x [[TYPE]]>* [[add3]] + things[3] = things[4] ^ things[5]; + + // CHECK: [[add6:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 6 + // CHECK: [[vec6:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add6]] + // CHECK: [[res4:%[0-9]*]] = or <[[NUM]] x [[TYPE]]> [[vec6]], [[vec4]] + // CHECK: store <[[NUM]] x [[TYPE]]> [[res4]], <[[NUM]] x [[TYPE]]>* [[add4]] + things[4] |= things[6]; + + // CHECK: [[add7:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 7 + // CHECK: [[vec7:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add7]] + // CHECK: [[res5:%[0-9]*]] = and <[[NUM]] x [[TYPE]]> [[vec7]], [[vec5]] + // CHECK: store <[[NUM]] x [[TYPE]]> [[res5]], <[[NUM]] x [[TYPE]]>* [[add5]] + things[5] &= things[7]; + + // CHECK: [[add8:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 8 + // CHECK: [[vec8:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add8]] + // CHECK: [[res6:%[0-9]*]] = xor <[[NUM]] x [[TYPE]]> [[vec6]], [[vec8]] + // CHECK: store <[[NUM]] x [[TYPE]]> [[res6]], <[[NUM]] x [[TYPE]]>* [[add6]] + things[6] ^= things[8]; + + // CHECK: ret void +} diff --git a/tools/clang/test/CodeGenDXIL/hlsl/types/longvec-operators.hlsl b/tools/clang/test/CodeGenDXIL/hlsl/types/longvec-operators.hlsl new file mode 100644 index 0000000000..b617bf15b1 --- /dev/null +++ b/tools/clang/test/CodeGenDXIL/hlsl/types/longvec-operators.hlsl @@ -0,0 +1,491 @@ +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=float -DNUM=2 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=float -DNUM=3 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=float -DNUM=4 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=float -DNUM=5 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=float -DNUM=6 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=float -DNUM=7 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=float -DNUM=8 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=float -DNUM=9 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=float -DNUM=10 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=float -DNUM=11 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=float -DNUM=12 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=float -DNUM=13 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=float -DNUM=14 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=float -DNUM=15 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=float -DNUM=16 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=float -DNUM=17 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=float -DNUM=18 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=float -DNUM=128 %s | FileCheck %s --check-prefixes=CHECK,NODBL + +// Less exhaustive testing for some other types. +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=int -DNUM=2 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=uint -DNUM=5 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=double -DNUM=3 -DDBL %s | FileCheck %s --check-prefixes=CHECK,DBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=uint64_t -DNUM=9 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=float16_t -DNUM=17 -enable-16bit-types %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=int16_t -DNUM=177 -enable-16bit-types %s | FileCheck %s --check-prefixes=CHECK,NODBL + +// Test relevant operators on an assortment bool vector sizes and types with 6.9 native vectors. + +// Just a trick to capture the needed type spellings since the DXC version of FileCheck can't do that explicitly. +// Uses non vector buffer to avoid interacting with that implementation. +// CHECK: %dx.types.ResRet.[[TY:[a-z0-9]*]] = type { [[TYPE:[a-z_0-9]*]] + +RWStructuredBuffer< TYPE > buf; + +export void assignments(inout vector things[10], TYPE scales[10]); +export vector arithmetic(inout vector things[11])[11]; +export vector scarithmetic(inout vector things[10], TYPE scales[10])[10]; +export vector logic(vector truth[10], vector consequences[10])[10]; +export vector index(vector things[10], int i, TYPE val)[10]; + +struct Interface { + vector assigned[10]; + vector arithmeticked[11]; + vector scarithmeticked[10]; + vector logicked[10]; + vector indexed[10]; + TYPE scales[10]; +}; + +#if 0 +// Requires vector loading support. Enable when available. +RWStructuredBuffer Input; +RWStructuredBuffer Output; + +TYPE g_val; + +[shader("compute")] +[numthreads(8,1,1)] +void main(uint GI : SV_GroupIndex) { + assignments(Output[GI].assigned, Input[GI].scales); + Output[GI].arithmeticked = arithmetic(Input[GI].arithmeticked); + Output[GI].scarithmeticked = scarithmetic(Input[GI].scarithmeticked, Input[GI].scales); + Output[GI].logicked = logic(Input[GI].logicked, Input[GI].assigned); + Output[GI].indexed = index(Input[GI].indexed, GI, g_val); +} +#endif + +// A mixed-type overload to test overload resolution and mingle different vector element types in ops +// Test assignment operators. +// CHECK-LABEL: define void @"\01?assignments +export void assignments(inout vector things[10], TYPE scales[10]) { + + // Another trick to capture the size. + // CHECK: [[res:%[0-9]*]] = call %dx.types.ResRet.[[TY]] @dx.op.rawBufferLoad.[[TY]](i32 139, %dx.types.Handle %{{[^,]*}}, i32 [[NUM:[0-9]*]] + // CHECK: [[scl:%[0-9]*]] = extractvalue %dx.types.ResRet.[[TY]] [[res]], 0 + TYPE scalar = buf.Load(NUM); + + // CHECK: [[spt:%[0-9]*]] = insertelement <[[NUM]] x [[TYPE]]> undef, [[TYPE]] [[scl]], i32 0 + // CHECK: [[res0:%[0-9]*]] = shufflevector <[[NUM]] x [[TYPE]]> [[spt]], <[[NUM]] x [[TYPE]]> undef, <[[NUM]] x i32> zeroinitializer + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 0 + // CHECK: store <[[NUM]] x [[TYPE]]> [[res0]], <[[NUM]] x [[TYPE]]>* [[add0]] + things[0] = scalar; + + // CHECK: [[add5:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 5 + // CHECK: [[vec5:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add5]] + // CHECK: [[add1:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 1 + // CHECK: [[vec1:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add1]] + // CHECK: [[res1:%[0-9]*]] = [[ADD:f?add( fast)?]] <[[NUM]] x [[TYPE]]> [[vec1]], [[vec5]] + // CHECK: store <[[NUM]] x [[TYPE]]> [[res1]], <[[NUM]] x [[TYPE]]>* [[add1]] + things[1] += things[5]; + + // CHECK: [[add6:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 6 + // CHECK: [[vec6:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add6]] + // CHECK: [[add2:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 2 + // CHECK: [[vec2:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add2]] + // CHECK: [[res2:%[0-9]*]] = [[SUB:f?sub( fast)?]] <[[NUM]] x [[TYPE]]> [[vec2]], [[vec6]] + // CHECK: store <[[NUM]] x [[TYPE]]> [[res2]], <[[NUM]] x [[TYPE]]>* [[add2]] + things[2] -= things[6]; + + // CHECK: [[add7:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 7 + // CHECK: [[vec7:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add7]] + // CHECK: [[add3:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 3 + // CHECK: [[vec3:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add3]] + // CHECK: [[res3:%[0-9]*]] = [[MUL:f?mul( fast)?]] <[[NUM]] x [[TYPE]]> [[vec3]], [[vec7]] + // CHECK: store <[[NUM]] x [[TYPE]]> [[res3]], <[[NUM]] x [[TYPE]]>* [[add3]] + things[3] *= things[7]; + + // CHECK: [[add8:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 8 + // CHECK: [[vec8:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add8]] + // CHECK: [[add4:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 4 + // CHECK: [[vec4:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add4]] + // CHECK: [[res4:%[0-9]*]] = [[DIV:[ufs]?div( fast)?]] <[[NUM]] x [[TYPE]]> [[vec4]], [[vec8]] + // CHECK: store <[[NUM]] x [[TYPE]]> [[res4]], <[[NUM]] x [[TYPE]]>* [[add4]] + things[4] /= things[8]; + + // CHECK: [[add9:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 9 + // CHECK: [[vec9:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add9]] +#ifdef DBL + // DBL: [[fvec9:%[0-9]*]] = fptrunc <[[NUM]] x double> [[vec9]] to <[[NUM]] x float> + // DBL: [[fvec5:%[0-9]*]] = fptrunc <[[NUM]] x double> [[vec5]] to <[[NUM]] x float> + // DBL: [[fres5:%[0-9]*]] = [[REM:[ufs]?rem( fast)?]] <[[NUM]] x float> [[fvec5]], [[fvec9]] + // DBL: [[res5:%[0-9]*]] = fpext <[[NUM]] x float> [[fres5]] to <[[NUM]] x double> + vector f9 = things[9]; + vector f5 = things[5]; + f5 %= f9; + things[5] = f5; +#else + // NODBL: [[res5:%[0-9]*]] = [[REM:[ufs]?rem( fast)?]] <[[NUM]] x [[TYPE]]> [[vec5]], [[vec9]] + things[5] %= things[9]; +#endif + // CHECK: store <[[NUM]] x [[TYPE]]> [[res5]], <[[NUM]] x [[TYPE]]>* [[add5]] + + // CHECK: [[add1:%[0-9]*]] = getelementptr inbounds [10 x [[TYPE]]], [10 x [[TYPE]]]* %scales, i32 0, i32 1 + // CHECK: [[scl1:%[0-9]*]] = load [[TYPE]], [[TYPE]]* [[add1]] + // CHECK: [[spt:%[0-9]*]] = insertelement <[[NUM]] x [[TYPE]]> undef, [[TYPE]] [[scl1]], i32 0 + // CHECK: [[spt1:%[0-9]*]] = shufflevector <[[NUM]] x [[TYPE]]> [[spt]], <[[NUM]] x [[TYPE]]> undef, <[[NUM]] x i32> zeroinitializer + // CHECK: [[res6:%[0-9]*]] = [[ADD]] <[[NUM]] x [[TYPE]]> [[spt1]], [[vec6]] + // CHECK: store <[[NUM]] x [[TYPE]]> [[res6]], <[[NUM]] x [[TYPE]]>* [[add6]] + things[6] += scales[1]; + + // CHECK: [[add2:%[0-9]*]] = getelementptr inbounds [10 x [[TYPE]]], [10 x [[TYPE]]]* %scales, i32 0, i32 2 + // CHECK: [[scl2:%[0-9]*]] = load [[TYPE]], [[TYPE]]* [[add2]] + // CHECK: [[spt:%[0-9]*]] = insertelement <[[NUM]] x [[TYPE]]> undef, [[TYPE]] [[scl2]], i32 0 + // CHECK: [[spt2:%[0-9]*]] = shufflevector <[[NUM]] x [[TYPE]]> [[spt]], <[[NUM]] x [[TYPE]]> undef, <[[NUM]] x i32> zeroinitializer + // CHECK: [[res7:%[0-9]*]] = [[SUB]] <[[NUM]] x [[TYPE]]> [[vec7]], [[spt2]] + // CHECK: store <[[NUM]] x [[TYPE]]> [[res7]], <[[NUM]] x [[TYPE]]>* [[add7]] + things[7] -= scales[2]; + + // CHECK: [[add3:%[0-9]*]] = getelementptr inbounds [10 x [[TYPE]]], [10 x [[TYPE]]]* %scales, i32 0, i32 3 + // CHECK: [[scl3:%[0-9]*]] = load [[TYPE]], [[TYPE]]* [[add3]] + // CHECK: [[spt:%[0-9]*]] = insertelement <[[NUM]] x [[TYPE]]> undef, [[TYPE]] [[scl3]], i32 0 + // CHECK: [[spt3:%[0-9]*]] = shufflevector <[[NUM]] x [[TYPE]]> [[spt]], <[[NUM]] x [[TYPE]]> undef, <[[NUM]] x i32> zeroinitializer + // CHECK: [[res8:%[0-9]*]] = [[MUL]] <[[NUM]] x [[TYPE]]> [[spt3]], [[vec8]] + // CHECK: store <[[NUM]] x [[TYPE]]> [[res8]], <[[NUM]] x [[TYPE]]>* [[add8]] + things[8] *= scales[3]; + + // CHECK: [[add4:%[0-9]*]] = getelementptr inbounds [10 x [[TYPE]]], [10 x [[TYPE]]]* %scales, i32 0, i32 4 + // CHECK: [[scl4:%[0-9]*]] = load [[TYPE]], [[TYPE]]* [[add4]] + // CHECK: [[spt:%[0-9]*]] = insertelement <[[NUM]] x [[TYPE]]> undef, [[TYPE]] [[scl4]], i32 0 + // CHECK: [[spt4:%[0-9]*]] = shufflevector <[[NUM]] x [[TYPE]]> [[spt]], <[[NUM]] x [[TYPE]]> undef, <[[NUM]] x i32> zeroinitializer + // CHECK: [[res9:%[0-9]*]] = [[DIV]] <[[NUM]] x [[TYPE]]> [[vec9]], [[spt4]] + // CHECK: store <[[NUM]] x [[TYPE]]> [[res9]], <[[NUM]] x [[TYPE]]>* [[add9]] + things[9] /= scales[4]; + +} + +// Test arithmetic operators. +// CHECK-LABEL: define void @"\01?arithmetic +export vector arithmetic(inout vector things[11])[11] { + vector res[11]; + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 0 + // CHECK: [[res1:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add0]] + // CHECK: [[res0:%[0-9]*]] = [[SUB]] <[[NUM]] x [[TYPE]]> + // CHECK: [[add1:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 1 + // CHECK: [[vec1:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add1]] + res[0] = -things[0]; + res[1] = +things[0]; + + // CHECK: [[add2:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 2 + // CHECK: [[vec2:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add2]] + // CHECK: [[res2:%[0-9]*]] = [[ADD]] <[[NUM]] x [[TYPE]]> [[vec2]], [[vec1]] + res[2] = things[1] + things[2]; + + // CHECK: [[add3:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 3 + // CHECK: [[vec3:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add3]] + // CHECK: [[res3:%[0-9]*]] = [[SUB]] <[[NUM]] x [[TYPE]]> [[vec2]], [[vec3]] + res[3] = things[2] - things[3]; + + // CHECK: [[add4:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 4 + // CHECK: [[vec4:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add4]] + // CHECK: [[res4:%[0-9]*]] = [[MUL]] <[[NUM]] x [[TYPE]]> [[vec4]], [[vec3]] + res[4] = things[3] * things[4]; + + // CHECK: [[add5:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 5 + // CHECK: [[vec5:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add5]] + // CHECK: [[res5:%[0-9]*]] = [[DIV]] <[[NUM]] x [[TYPE]]> [[vec4]], [[vec5]] + res[5] = things[4] / things[5]; + + // DBL: [[fvec5:%[0-9]*]] = fptrunc <[[NUM]] x double> [[vec5]] to <[[NUM]] x float> + // CHECK: [[add6:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 6 + // CHECK: [[vec6:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add6]] +#ifdef DBL + // DBL: [[fvec6:%[0-9]*]] = fptrunc <[[NUM]] x double> [[vec6]] to <[[NUM]] x float> + // DBL: [[fres6:%[0-9]*]] = [[REM]] <[[NUM]] x float> [[fvec5]], [[fvec6]] + // DBL: [[res6:%[0-9]*]] = fpext <[[NUM]] x float> [[fres6]] to <[[NUM]] x double> + res[6] = (vector)things[5] % (vector)things[6]; +#else + // NODBL: [[res6:%[0-9]*]] = [[REM]] <[[NUM]] x [[TYPE]]> [[vec5]], [[vec6]] + res[6] = things[5] % things[6]; +#endif + + // CHECK: [[add7:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 7 + // CHECK: [[vec7:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add7]] + // CHECK: [[res7:%[0-9]*]] = [[ADD]] <[[NUM]] x [[TYPE]]> [[vec7]] + // CHECK: store <[[NUM]] x [[TYPE]]> [[res7]], <[[NUM]] x [[TYPE]]>* [[add7]] + res[7] = things[7]++; + + // CHECK: [[add8:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 8 + // CHECK: [[vec8:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add8]] + // CHECK: [[res8:%[0-9]*]] = [[ADD]] <[[NUM]] x [[TYPE]]> [[vec8]] + // CHECK: store <[[NUM]] x [[TYPE]]> [[res8]], <[[NUM]] x [[TYPE]]>* [[add8]] + res[8] = things[8]--; + + // CHECK: [[add9:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 9 + // CHECK: [[vec9:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add9]] + // CHECK: [[res9:%[0-9]*]] = [[ADD]] <[[NUM]] x [[TYPE]]> [[vec9]] + // CHECK: store <[[NUM]] x [[TYPE]]> [[res9]], <[[NUM]] x [[TYPE]]>* [[add9]] + res[9] = ++things[9]; + + // CHECK: [[add10:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 10 + // CHECK: [[vec10:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add10]] + // CHECK: [[res10:%[0-9]*]] = [[ADD]] <[[NUM]] x [[TYPE]]> [[vec10]] + // CHECK: store <[[NUM]] x [[TYPE]]> [[res10]], <[[NUM]] x [[TYPE]]>* [[add10]] + res[10] = --things[10]; + + // Stores into res[]. Previous were for things[] inout. + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %agg.result, i32 0, i32 0 + // CHECK: store <[[NUM]] x [[TYPE]]> [[res0]], <[[NUM]] x [[TYPE]]>* [[add0]] + // CHECK: [[add1:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %agg.result, i32 0, i32 1 + // CHECK: store <[[NUM]] x [[TYPE]]> [[res1]], <[[NUM]] x [[TYPE]]>* [[add1]] + // CHECK: [[add2:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %agg.result, i32 0, i32 2 + // CHECK: store <[[NUM]] x [[TYPE]]> [[res2]], <[[NUM]] x [[TYPE]]>* [[add2]] + // CHECK: [[add3:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %agg.result, i32 0, i32 3 + // CHECK: store <[[NUM]] x [[TYPE]]> [[res3]], <[[NUM]] x [[TYPE]]>* [[add3]] + // CHECK: [[add4:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %agg.result, i32 0, i32 4 + // CHECK: store <[[NUM]] x [[TYPE]]> [[res4]], <[[NUM]] x [[TYPE]]>* [[add4]] + // CHECK: [[add5:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %agg.result, i32 0, i32 5 + // CHECK: store <[[NUM]] x [[TYPE]]> [[res5]], <[[NUM]] x [[TYPE]]>* [[add5]] + // CHECK: [[add6:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %agg.result, i32 0, i32 6 + // CHECK: store <[[NUM]] x [[TYPE]]> [[res6]], <[[NUM]] x [[TYPE]]>* [[add6]] + // These two were post ops, so the original value goes into res[]. + // CHECK: [[add7:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %agg.result, i32 0, i32 7 + // CHECK: store <[[NUM]] x [[TYPE]]> [[vec7]], <[[NUM]] x [[TYPE]]>* [[add7]] + // CHECK: [[add8:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %agg.result, i32 0, i32 8 + // CHECK: store <[[NUM]] x [[TYPE]]> [[vec8]], <[[NUM]] x [[TYPE]]>* [[add8]] + // CHECK: [[add9:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %agg.result, i32 0, i32 9 + // CHECK: store <[[NUM]] x [[TYPE]]> [[res9]], <[[NUM]] x [[TYPE]]>* [[add9]] + // CHECK: [[add10:%[0-9]*]] = getelementptr inbounds [11 x <[[NUM]] x [[TYPE]]>], [11 x <[[NUM]] x [[TYPE]]>]* %agg.result, i32 0, i32 10 + // CHECK: store <[[NUM]] x [[TYPE]]> [[res10]], <[[NUM]] x [[TYPE]]>* [[add10]] + // CHECK: ret void + + + return res; +} + +// Test arithmetic operators with scalars. +// CHECK-LABEL: define void @"\01?scarithmetic +export vector scarithmetic(inout vector things[10], TYPE scales[10])[10] { + vector res[10]; + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 0 + // CHECK: [[vec0:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add0]] + // CHECK: [[add1:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 1 + // CHECK: [[vec1:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add1]] + // CHECK: [[add2:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 2 + // CHECK: [[vec2:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add2]] + // CHECK: [[add3:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 3 + // CHECK: [[vec3:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add3]] + // CHECK: [[add4:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 4 + // CHECK: [[vec4:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add4]] + // CHECK: [[add5:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 5 + // CHECK: [[vec5:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add5]] + // CHECK: [[add6:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 6 + // CHECK: [[vec6:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add6]] + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [10 x [[TYPE]]], [10 x [[TYPE]]]* %scales, i32 0, i32 0 + // CHECK: [[scl0:%[0-9]*]] = load [[TYPE]], [[TYPE]]* [[add0]] + // CHECK: [[spt:%[0-9]*]] = insertelement <[[NUM]] x [[TYPE]]> undef, [[TYPE]] [[scl0]], i32 0 + // CHECK: [[spt0:%[0-9]*]] = shufflevector <[[NUM]] x [[TYPE]]> [[spt]], <[[NUM]] x [[TYPE]]> undef, <[[NUM]] x i32> zeroinitializer + // CHECK: [[res0:%[0-9]*]] = [[ADD]] <[[NUM]] x [[TYPE]]> [[spt0]], [[vec0]] + res[0] = things[0] + scales[0]; + + // CHECK: [[add1:%[0-9]*]] = getelementptr inbounds [10 x [[TYPE]]], [10 x [[TYPE]]]* %scales, i32 0, i32 1 + // CHECK: [[scl1:%[0-9]*]] = load [[TYPE]], [[TYPE]]* [[add1]] + // CHECK: [[spt:%[0-9]*]] = insertelement <[[NUM]] x [[TYPE]]> undef, [[TYPE]] [[scl1]], i32 0 + // CHECK: [[spt1:%[0-9]*]] = shufflevector <[[NUM]] x [[TYPE]]> [[spt]], <[[NUM]] x [[TYPE]]> undef, <[[NUM]] x i32> zeroinitializer + // CHECK: [[res1:%[0-9]*]] = [[SUB]] <[[NUM]] x [[TYPE]]> [[vec1]], [[spt1]] + res[1] = things[1] - scales[1]; + + + // CHECK: [[add2:%[0-9]*]] = getelementptr inbounds [10 x [[TYPE]]], [10 x [[TYPE]]]* %scales, i32 0, i32 2 + // CHECK: [[scl2:%[0-9]*]] = load [[TYPE]], [[TYPE]]* [[add2]] + // CHECK: [[spt:%[0-9]*]] = insertelement <[[NUM]] x [[TYPE]]> undef, [[TYPE]] [[scl2]], i32 0 + // CHECK: [[spt2:%[0-9]*]] = shufflevector <[[NUM]] x [[TYPE]]> [[spt]], <[[NUM]] x [[TYPE]]> undef, <[[NUM]] x i32> zeroinitializer + // CHECK: [[res2:%[0-9]*]] = [[MUL]] <[[NUM]] x [[TYPE]]> [[spt2]], [[vec2]] + res[2] = things[2] * scales[2]; + + // CHECK: [[add3:%[0-9]*]] = getelementptr inbounds [10 x [[TYPE]]], [10 x [[TYPE]]]* %scales, i32 0, i32 3 + // CHECK: [[scl3:%[0-9]*]] = load [[TYPE]], [[TYPE]]* [[add3]] + // CHECK: [[spt:%[0-9]*]] = insertelement <[[NUM]] x [[TYPE]]> undef, [[TYPE]] [[scl3]], i32 0 + // CHECK: [[spt3:%[0-9]*]] = shufflevector <[[NUM]] x [[TYPE]]> [[spt]], <[[NUM]] x [[TYPE]]> undef, <[[NUM]] x i32> zeroinitializer + // CHECK: [[res3:%[0-9]*]] = [[DIV]] <[[NUM]] x [[TYPE]]> [[vec3]], [[spt3]] + res[3] = things[3] / scales[3]; + + // CHECK: [[add4:%[0-9]*]] = getelementptr inbounds [10 x [[TYPE]]], [10 x [[TYPE]]]* %scales, i32 0, i32 4 + // CHECK: [[scl4:%[0-9]*]] = load [[TYPE]], [[TYPE]]* [[add4]] + // CHECK: [[spt:%[0-9]*]] = insertelement <[[NUM]] x [[TYPE]]> undef, [[TYPE]] [[scl4]], i32 0 + // CHECK: [[spt4:%[0-9]*]] = shufflevector <[[NUM]] x [[TYPE]]> [[spt]], <[[NUM]] x [[TYPE]]> undef, <[[NUM]] x i32> zeroinitializer + // CHECK: [[res4:%[0-9]*]] = [[ADD]] <[[NUM]] x [[TYPE]]> [[spt4]], [[vec4]] + res[4] = scales[4] + things[4]; + + // CHECK: [[add5:%[0-9]*]] = getelementptr inbounds [10 x [[TYPE]]], [10 x [[TYPE]]]* %scales, i32 0, i32 5 + // CHECK: [[scl5:%[0-9]*]] = load [[TYPE]], [[TYPE]]* [[add5]] + // CHECK: [[spt:%[0-9]*]] = insertelement <[[NUM]] x [[TYPE]]> undef, [[TYPE]] [[scl5]], i32 0 + // CHECK: [[spt5:%[0-9]*]] = shufflevector <[[NUM]] x [[TYPE]]> [[spt]], <[[NUM]] x [[TYPE]]> undef, <[[NUM]] x i32> zeroinitializer + // CHECK: [[res5:%[0-9]*]] = [[SUB]] <[[NUM]] x [[TYPE]]> [[spt5]], [[vec5]] + res[5] = scales[5] - things[5]; + + // CHECK: [[add6:%[0-9]*]] = getelementptr inbounds [10 x [[TYPE]]], [10 x [[TYPE]]]* %scales, i32 0, i32 6 + // CHECK: [[scl6:%[0-9]*]] = load [[TYPE]], [[TYPE]]* [[add6]] + // CHECK: [[spt:%[0-9]*]] = insertelement <[[NUM]] x [[TYPE]]> undef, [[TYPE]] [[scl6]], i32 0 + // CHECK: [[spt6:%[0-9]*]] = shufflevector <[[NUM]] x [[TYPE]]> [[spt]], <[[NUM]] x [[TYPE]]> undef, <[[NUM]] x i32> zeroinitializer + // CHECK: [[res6:%[0-9]*]] = [[MUL]] <[[NUM]] x [[TYPE]]> [[spt6]], [[vec6]] + res[6] = scales[6] * things[6]; + + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %agg.result, i32 0, i32 0 + // CHECK: store <[[NUM]] x [[TYPE]]> [[res0]], <[[NUM]] x [[TYPE]]>* [[add0]] + // CHECK: [[add1:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %agg.result, i32 0, i32 1 + // CHECK: store <[[NUM]] x [[TYPE]]> [[res1]], <[[NUM]] x [[TYPE]]>* [[add1]] + // CHECK: [[add2:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %agg.result, i32 0, i32 2 + // CHECK: store <[[NUM]] x [[TYPE]]> [[res2]], <[[NUM]] x [[TYPE]]>* [[add2]] + // CHECK: [[add3:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %agg.result, i32 0, i32 3 + // CHECK: store <[[NUM]] x [[TYPE]]> [[res3]], <[[NUM]] x [[TYPE]]>* [[add3]] + // CHECK: [[add4:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %agg.result, i32 0, i32 4 + // CHECK: store <[[NUM]] x [[TYPE]]> [[res4]], <[[NUM]] x [[TYPE]]>* [[add4]] + // CHECK: [[add5:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %agg.result, i32 0, i32 5 + // CHECK: store <[[NUM]] x [[TYPE]]> [[res5]], <[[NUM]] x [[TYPE]]>* [[add5]] + // CHECK: [[add6:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %agg.result, i32 0, i32 6 + // CHECK: store <[[NUM]] x [[TYPE]]> [[res6]], <[[NUM]] x [[TYPE]]>* [[add6]] + // CHECK: ret void + + + return res; +} + +// Test logic operators. +// Only permissable in pre-HLSL2021 +// CHECK-LABEL: define void @"\01?logic +export vector logic(vector truth[10], vector consequences[10])[10] { + vector res[10]; + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %truth, i32 0, i32 0 + // CHECK: [[vec0:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add0]] + // CHECK: [[cmp:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec0]], zeroinitializer + // CHECK: [[cmp0:%[0-9]*]] = icmp eq <[[NUM]] x i1> [[cmp]], zeroinitializer + // CHECK: [[res0:%[0-9]*]] = zext <[[NUM]] x i1> [[cmp0]] to <[[NUM]] x i32> + res[0] = !truth[0]; + + // CHECK: [[add1:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %truth, i32 0, i32 1 + // CHECK: [[vec1:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add1]] + // CHECK: [[bvec1:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec1]], zeroinitializer + // CHECK: [[add2:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %truth, i32 0, i32 2 + // CHECK: [[vec2:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add2]] + // CHECK: [[bvec2:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec2]], zeroinitializer + // CHECK: [[bres1:%[0-9]*]] = or <[[NUM]] x i1> [[bvec2]], [[bvec1]] + // CHECK: [[res1:%[0-9]*]] = zext <[[NUM]] x i1> [[bres1]] to <[[NUM]] x i32> + res[1] = truth[1] || truth[2]; + + // CHECK: [[add3:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %truth, i32 0, i32 3 + // CHECK: [[vec3:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add3]] + // CHECK: [[bvec3:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec3]], zeroinitializer + // CHECK: [[bres2:%[0-9]*]] = and <[[NUM]] x i1> [[bvec3]], [[bvec2]] + // CHECK: [[res2:%[0-9]*]] = zext <[[NUM]] x i1> [[bres2]] to <[[NUM]] x i32> + res[2] = truth[2] && truth[3]; + + // CHECK: [[add4:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %truth, i32 0, i32 4 + // CHECK: [[vec4:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add4]] + // CHECK: [[bvec4:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec4]], zeroinitializer + // CHECK: [[add5:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %truth, i32 0, i32 5 + // CHECK: [[vec5:%[0-9]*]] = load <[[NUM]] x i32>, <[[NUM]] x i32>* [[add5]] + // CHECK: [[bvec5:%[0-9]*]] = icmp ne <[[NUM]] x i32> [[vec5]], zeroinitializer + + // NOT RIGHT STUFF.. Select is still extracting everything, slows WAY down with over 100 elements + + res[3] = truth[3] ? truth[4] : truth[5]; + + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %consequences, i32 0, i32 0 + // CHECK: [[vec0:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add0]] + // CHECK: [[add1:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %consequences, i32 0, i32 1 + // CHECK: [[vec1:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add1]] + // CHECK: [[cmp4:%[0-9]*]] = [[CMP:[fi]?cmp( fast)?]] {{o?}}eq <[[NUM]] x [[TYPE]]> [[vec0]], [[vec1]] + // CHECK: [[res4:%[0-9]*]] = zext <[[NUM]] x i1> [[cmp4]] to <[[NUM]] x i32> + res[4] = consequences[0] == consequences[1]; + + // CHECK: [[add2:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %consequences, i32 0, i32 2 + // CHECK: [[vec2:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add2]] + // CHECK: [[cmp5:%[0-9]*]] = [[CMP]] {{u?}}ne <[[NUM]] x [[TYPE]]> [[vec1]], [[vec2]] + // CHECK: [[res5:%[0-9]*]] = zext <[[NUM]] x i1> [[cmp5]] to <[[NUM]] x i32> + res[5] = consequences[1] != consequences[2]; + + // CHECK: [[add3:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %consequences, i32 0, i32 3 + // CHECK: [[vec3:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add3]] + // CHECK: [[cmp6:%[0-9]*]] = [[CMP]] {{[osu]?}}lt <[[NUM]] x [[TYPE]]> [[vec2]], [[vec3]] + // CHECK: [[res6:%[0-9]*]] = zext <[[NUM]] x i1> [[cmp6]] to <[[NUM]] x i32> + res[6] = consequences[2] < consequences[3]; + + // CHECK: [[add4:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %consequences, i32 0, i32 4 + // CHECK: [[vec4:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add4]] + // CHECK: [[cmp7:%[0-9]*]] = [[CMP]] {{[osu]]?}}gt <[[NUM]] x [[TYPE]]> [[vec3]], [[vec4]] + // CHECK: [[res7:%[0-9]*]] = zext <[[NUM]] x i1> [[cmp7]] to <[[NUM]] x i32> + res[7] = consequences[3] > consequences[4]; + + // CHECK: [[add5:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %consequences, i32 0, i32 5 + // CHECK: [[vec5:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add5]] + // CHECK: [[cmp8:%[0-9]*]] = [[CMP]] {{[osu]]?}}le <[[NUM]] x [[TYPE]]> [[vec4]], [[vec5]] + // CHECK: [[res8:%[0-9]*]] = zext <[[NUM]] x i1> [[cmp8]] to <[[NUM]] x i32> + res[8] = consequences[4] <= consequences[5]; + + // CHECK: [[add6:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %consequences, i32 0, i32 6 + // CHECK: [[vec6:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add6]] + // CHECK: [[cmp9:%[0-9]*]] = [[CMP]] {{[osu]?}}ge <[[NUM]] x [[TYPE]]> [[vec5]], [[vec6]] + // CHECK: [[res9:%[0-9]*]] = zext <[[NUM]] x i1> [[cmp9]] to <[[NUM]] x i32> + res[9] = consequences[5] >= consequences[6]; + + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 0 + // CHECK: store <[[NUM]] x i32> [[res0]], <[[NUM]] x i32>* [[add0]] + // CHECK: [[add4:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 4 + // CHECK: store <[[NUM]] x i32> [[res4]], <[[NUM]] x i32>* [[add4]] + // CHECK: [[add5:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 5 + // CHECK: store <[[NUM]] x i32> [[res5]], <[[NUM]] x i32>* [[add5]] + // CHECK: [[add6:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 6 + // CHECK: store <[[NUM]] x i32> [[res6]], <[[NUM]] x i32>* [[add6]] + // CHECK: [[add7:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 7 + // CHECK: store <[[NUM]] x i32> [[res7]], <[[NUM]] x i32>* [[add7]] + // CHECK: [[add8:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 8 + // CHECK: store <[[NUM]] x i32> [[res8]], <[[NUM]] x i32>* [[add8]] + // CHECK: [[add9:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x i32>], [10 x <[[NUM]] x i32>]* %agg.result, i32 0, i32 9 + // CHECK: store <[[NUM]] x i32> [[res9]], <[[NUM]] x i32>* [[add9]] + // CHECK: ret void + + return res; +} + +static const int Ix = 2; + +// Test indexing operators +// CHECK-LABEL: define void @"\01?index +export vector index(vector things[10], int i, TYPE val)[10] { + vector res[10]; + + // CHECK: [[res:%[0-9]*]] = alloca [10 x <[[NUM]] x [[TYPE]]>] + // CHECK: [[res0:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* [[res]], i32 0, i32 0 + // CHECK: store <[[NUM]] x [[TYPE]]> zeroinitializer, <[[NUM]] x [[TYPE]]>* [[res0]] + res[0] = 0; + + // CHECK: [[resi:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* [[res]], i32 0, i32 %i + // CHECK: store <[[NUM]] x [[TYPE]]> <[[TYPE]] {{(1|0xH3C00).*}}>, <[[NUM]] x [[TYPE]]>* [[resi]] + res[i] = 1; + + // CHECK: [[res2:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* [[res]], i32 0, i32 2 + // CHECK: store <[[NUM]] x [[TYPE]]> <[[TYPE]] {{(2|0xH4000).*}}>, <[[NUM]] x [[TYPE]]>* [[res2]] + res[Ix] = 2; + + // CHECK: [[add0:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 0 + // CHECK: [[thg0:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add0]] + // CHECK: [[res3:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* [[res]], i32 0, i32 3 + // CHECK: store <[[NUM]] x [[TYPE]]> [[thg0]], <[[NUM]] x [[TYPE]]>* [[res3]] + res[3] = things[0]; + + // CHECK: [[addi:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 %i + // CHECK: [[thgi:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[addi]] + // CHECK: [[res4:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* [[res]], i32 0, i32 4 + // CHECK: store <[[NUM]] x [[TYPE]]> [[thgi]], <[[NUM]] x [[TYPE]]>* [[res4]] + res[4] = things[i]; + + // CHECK: [[add2:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* %things, i32 0, i32 2 + // CHECK: [[thg2:%[0-9]*]] = load <[[NUM]] x [[TYPE]]>, <[[NUM]] x [[TYPE]]>* [[add2]] + // CHECK: [[res5:%[0-9]*]] = getelementptr inbounds [10 x <[[NUM]] x [[TYPE]]>], [10 x <[[NUM]] x [[TYPE]]>]* [[res]], i32 0, i32 5 + // CHECK: store <[[NUM]] x [[TYPE]]> [[thg2]], <[[NUM]] x [[TYPE]]>* [[res5]] + res[5] = things[Ix]; + // CHECK: ret void + return res; +} diff --git a/tools/clang/unittests/HLSL/LinkerTest.cpp b/tools/clang/unittests/HLSL/LinkerTest.cpp index 7cafa0db06..df8bb644e1 100644 --- a/tools/clang/unittests/HLSL/LinkerTest.cpp +++ b/tools/clang/unittests/HLSL/LinkerTest.cpp @@ -526,6 +526,11 @@ TEST_F(LinkerTest, RunLinkMatArrayParam) { Link(L"main", L"ps_6_0", pLinker, {libName, libName2}, {"alloca [24 x float]", "getelementptr [12 x float], [12 x float]*"}, {}); + + Link(L"main", L"ps_6_9", pLinker, {libName, libName2}, + {"alloca [2 x <12 x float>]", + "getelementptr [12 x float], [12 x float]*"}, + {}); } TEST_F(LinkerTest, RunLinkMatParam) { diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 66376c3b9b..4c2294b2a6 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -1175,6 +1175,37 @@ def populate_llvm_instructions(self): self.add_llvm_instr( "OTHER", 53, "VAArg", "VAArgInst", "vaarg instruction", "", [] ) + + self.add_llvm_instr( + "OTHER", + 54, + "ExtractElement", + "ExtractElementInst", + "extracts from vector", + "", + [], + ) + + self.add_llvm_instr( + "OTHER", + 55, + "InsertElement", + "InsertElementInst", + "inserts into vector", + "", + [], + ) + + self.add_llvm_instr( + "OTHER", + 56, + "ShuffleVector", + "ShuffleVectorInst", + "Shuffle two vectors", + "", + [], + ) + self.add_llvm_instr( "OTHER", 57, From b69d67cdb25994ae09fc42b4aa806f3d9cc0210e Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Mon, 27 Jan 2025 10:05:34 -0700 Subject: [PATCH 19/45] Create new raw buffer load lowering function Disentangles the raw buffer lowering implmentation into an isolated function. Alters the various places that lowering took place to call into the common function. This function will be expanded to handle other lowering later. When raw buffers use a templated load with a struct, they reuse the subscript path also used for subscripted structured buffers. Such loads with structs containing vectors or matrices will invoke the load lowering from within this recursive call that traverses GEPs and other users of the original call to set up correct offsets etc. This adapts that code to use the common load lowering that enables long vectors within structs to be correctly loaded. Since the code expects byte address buffers, it is not (yet) adapted to structured buffers, so those code paths are kept as they were. This requires the ability to override the type used by the resloadhelper explicitly, so a member is added to accomodate the matrices vector representation that doesn't match the types of the load call. This also requires removing the bufIdx and offset swapping that was done, confusingly throughout the TranslateStructBufSubscriptUser code to account for the fact that byte address buffers have to represent offsets using the main coord parameter in favor of passing the Resource Kind down such that the right parameter can receive the incrementation when necessary for longer types such as matrices. This is enabled also by adding ResKind appropriate offset calculation in the ResLoadHelper. ResLoadHelper also gets an opcode set based on the ResKind for both overaloads in preparation for further expansion to different resource kinds. --- lib/HLSL/HLOperationLower.cpp | 334 +++++++++++++++++++++++----------- 1 file changed, 227 insertions(+), 107 deletions(-) diff --git a/lib/HLSL/HLOperationLower.cpp b/lib/HLSL/HLOperationLower.cpp index bc293357d6..c42ddfc17e 100644 --- a/lib/HLSL/HLOperationLower.cpp +++ b/lib/HLSL/HLOperationLower.cpp @@ -2988,9 +2988,10 @@ static Value *ScalarizeResRet(Type *RetTy, Value *ResRet, static Value *ScalarizeElements(Type *RetTy, ArrayRef Elts, IRBuilder<> &Builder) { // Extract value part. - Value *retVal = llvm::UndefValue::get(RetTy); + Value *retVal = nullptr; if (RetTy->isVectorTy()) { unsigned vecSize = RetTy->getVectorNumElements(); + retVal = UndefValue::get(VectorType::get(Elts[0]->getType(), vecSize)); DXASSERT(vecSize <= Elts.size(), "vector size mismatch"); for (unsigned i = 0; i < vecSize; i++) { Value *retComp = Elts[i]; @@ -3941,14 +3942,41 @@ TranslateWriteSamplerFeedback(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, } // Load/Store intrinsics. +OP::OpCode LoadOpFromResKind(DxilResource::Kind RK) { + switch (RK) { + case DxilResource::Kind::RawBuffer: + case DxilResource::Kind::StructuredBuffer: + return OP::OpCode::RawBufferLoad; + case DxilResource::Kind::TypedBuffer: + return OP::OpCode::BufferLoad; + case DxilResource::Kind::Invalid: + DXASSERT(0, "invalid resource kind"); + break; + default: + return OP::OpCode::TextureLoad; + } + return OP::OpCode::TextureLoad; +} + struct ResLoadHelper { + // Default constructor uses CI load intrinsic call + // to get the retval and various location indicators. ResLoadHelper(CallInst *CI, DxilResource::Kind RK, DxilResourceBase::Class RC, Value *h, IntrinsicOp IOP, bool bForSubscript = false); - // For double subscript. - ResLoadHelper(Instruction *ldInst, Value *h, Value *idx, Value *mip) - : opcode(OP::OpCode::TextureLoad), - intrinsicOpCode(IntrinsicOp::Num_Intrinsics), handle(h), retVal(ldInst), - addr(idx), offset(nullptr), status(nullptr), mipLevel(mip) {} + // Alternative constructor explicitly sets the index. + // Used for some subscript operators. + ResLoadHelper(Instruction *ldInst, DxilResource::Kind RK, Value *h, + Value *idx, Value *mip = nullptr) + : intrinsicOpCode(IntrinsicOp::Num_Intrinsics), handle(h), retVal(ldInst), + addr(idx), offset(nullptr), status(nullptr), mipLevel(mip) { + opcode = LoadOpFromResKind(RK); + Type *i32Ty = IRBuilder<>(ldInst).getInt32Ty(); + if (DXIL::IsStructuredBuffer(RK)) + offset = ConstantInt::get(i32Ty, 0U); + else + offset = UndefValue::get(i32Ty); + Ty = ldInst->getType(); + } OP::OpCode opcode; IntrinsicOp intrinsicOpCode; unsigned dxilMajor; @@ -3959,28 +3987,16 @@ struct ResLoadHelper { Value *offset; Value *status; Value *mipLevel; + Type *Ty; }; ResLoadHelper::ResLoadHelper(CallInst *CI, DxilResource::Kind RK, DxilResourceBase::Class RC, Value *hdl, IntrinsicOp IOP, bool bForSubscript) : intrinsicOpCode(IOP), handle(hdl), offset(nullptr), status(nullptr) { - switch (RK) { - case DxilResource::Kind::RawBuffer: - case DxilResource::Kind::StructuredBuffer: - opcode = OP::OpCode::RawBufferLoad; - break; - case DxilResource::Kind::TypedBuffer: - opcode = OP::OpCode::BufferLoad; - break; - case DxilResource::Kind::Invalid: - DXASSERT(0, "invalid resource kind"); - break; - default: - opcode = OP::OpCode::TextureLoad; - break; - } + opcode = LoadOpFromResKind(RK); retVal = CI; + Ty = CI->getType(); const unsigned kAddrIdx = HLOperandIndex::kBufLoadAddrOpIdx; addr = CI->getArgOperand(kAddrIdx); unsigned argc = CI->getNumArgOperands(); @@ -4041,6 +4057,11 @@ ResLoadHelper::ResLoadHelper(CallInst *CI, DxilResource::Kind RK, const unsigned kStatusIdx = HLOperandIndex::kBufLoadStatusOpIdx; if (argc > kStatusIdx) status = CI->getArgOperand(kStatusIdx); + Type *i32Ty = IRBuilder<>(CI).getInt32Ty(); + if (DXIL::IsStructuredBuffer(RK)) + offset = ConstantInt::get(i32Ty, 0U); + else + offset = UndefValue::get(i32Ty); } } @@ -4115,18 +4136,89 @@ static Value *TranslateRawBufVecLd(Type *VecEltTy, unsigned VecElemCount, std::vector &bufLds, unsigned baseAlign, bool isScalarTy = false); +Value *TranslateBufLoad(ResLoadHelper &helper, HLResource::Kind RK, + IRBuilder<> &Builder, hlsl::OP *OP, + const DataLayout &DL) { + // Collect information about the resource type. + Type *Ty = helper.Ty; + Type *EltTy = Ty->getScalarType(); + unsigned numComponents = 1; + + if (Ty->isVectorTy()) { + numComponents = Ty->getVectorNumElements(); + } + + Type *i32Ty = Builder.getInt32Ty(); + const bool isBool = EltTy->isIntegerTy(1); + if (isBool) + // Value will be loaded in its memory representation. + EltTy = i32Ty; + + unsigned EltSize = DL.getTypeAllocSize(EltTy); + unsigned alignment = std::min(4U, EltSize); + Constant *alignmentVal = OP->GetI32Const(alignment); + + std::vector elts(numComponents); + OP::OpCode opcode = helper.opcode; + Function *F = OP->GetOpFunc(opcode, EltTy); + llvm::Constant *opArg = OP->GetU32Const((unsigned)opcode); + + // Assemble args appropriate to the load being lowered. + SmallVector Args; + Args.emplace_back(opArg); // opcode @0 + Args.emplace_back(helper.handle); // resource handle @1 + const unsigned kCoordIdx = 2; + Args.emplace_back(helper.addr); // coord (may be changed later) @2 + Args.emplace_back(helper.offset); // offset (may be changed later) @3 + const unsigned kMaskIdx = 4; + Args.emplace_back(nullptr); // mask (to be added later) @4 + Args.emplace_back(alignmentVal); // alignment @5 + + // Keep track of the first load for debug info migration. + Value *firstLd = nullptr; + for (unsigned i = 0; i < numComponents;) { + unsigned chunkSize = (numComponents - i) <= 4 ? numComponents - i : 4; + + // Assign mask for raw buffer loads. + Args[kMaskIdx] = GetRawBufferMaskForETy(EltTy, chunkSize, OP); + Value *Ld = Builder.CreateCall(F, Args, OP::GetOpCodeName(opcode)); + + // Extract values from the ResRet structure returned by the load call. + for (unsigned j = 0; j < chunkSize; j++) + elts[i++] = Builder.CreateExtractValue(Ld, j); + + // Update status. + UpdateStatus(Ld, helper.status, Builder, OP); + + if (!firstLd) + firstLd = Ld; + + if (i < numComponents) + // Raw buffers can't use offset param. Add to coord index. + Args[kCoordIdx] = + Builder.CreateAdd(Args[kCoordIdx], OP->GetU32Const(4 * EltSize)); + } + + Value *retValNew = ScalarizeElements(Ty, elts, Builder); + + DXASSERT(firstLd, "No loads created by TranslateBufLoad"); + + if (isBool) { + // Convert bool result back to register representation. + retValNew = Builder.CreateICmpNE( + retValNew, Constant::getNullValue(retValNew->getType())); + } + + helper.retVal->replaceAllUsesWith(retValNew); + helper.retVal = retValNew; + + return firstLd; +} + void TranslateLoad(ResLoadHelper &helper, HLResource::Kind RK, IRBuilder<> &Builder, hlsl::OP *OP, const DataLayout &DL) { Type *Ty = helper.retVal->getType(); - if (Ty->isPointerTy()) { - DXASSERT(!DxilResource::IsAnyTexture(RK), - "Textures should not be treated as structured buffers."); - TranslateStructBufSubscript(cast(helper.retVal), helper.handle, - helper.status, OP, RK, DL); - return; - } - OP::OpCode opcode = helper.opcode; Type *i32Ty = Builder.getInt32Ty(); @@ -4138,7 +4230,7 @@ void TranslateLoad(ResLoadHelper &helper, HLResource::Kind RK, numComponents = Ty->getVectorNumElements(); } - if (DXIL::IsStructuredBuffer(RK) || DXIL::IsRawBuffer(RK)) { + if (DXIL::IsStructuredBuffer(RK)) { std::vector bufLds; const bool isBool = EltTy->isIntegerTy(1); @@ -4147,17 +4239,10 @@ void TranslateLoad(ResLoadHelper &helper, HLResource::Kind RK, bool isScalarTy = !Ty->isVectorTy(); Value *retValNew = nullptr; - if (DXIL::IsStructuredBuffer(RK)) { - retValNew = TranslateRawBufVecLd( - MemReprTy, numComponents, Builder, helper.handle, OP, helper.status, - helper.addr, OP->GetU32Const(0), DL, bufLds, - /*baseAlign (in bytes)*/ 8, isScalarTy); - } else { - retValNew = - TranslateRawBufVecLd(MemReprTy, numComponents, Builder, helper.handle, - OP, helper.status, nullptr, helper.addr, DL, - bufLds, /*baseAlign (in bytes)*/ 4, isScalarTy); - } + retValNew = TranslateRawBufVecLd( + MemReprTy, numComponents, Builder, helper.handle, OP, helper.status, + helper.addr, OP->GetU32Const(0), DL, bufLds, + /*baseAlign (in bytes)*/ 8, isScalarTy); DXASSERT_NOMSG(!bufLds.empty()); dxilutil::MigrateDebugValue(helper.retVal, bufLds.front()); @@ -4292,6 +4377,7 @@ Value *TranslateResourceLoad(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, HLObjectOperationLowerHelper *pObjHelper, bool &Translated) { hlsl::OP *hlslOP = &helper.hlslOP; + DataLayout &DL = helper.dataLayout; Value *handle = CI->getArgOperand(HLOperandIndex::kHandleOpIdx); IRBuilder<> Builder(CI); @@ -4299,9 +4385,21 @@ Value *TranslateResourceLoad(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, DXIL::ResourceClass RC = pObjHelper->GetRC(handle); DXIL::ResourceKind RK = pObjHelper->GetRK(handle); - ResLoadHelper loadHelper(CI, RK, RC, handle, IOP); - TranslateLoad(loadHelper, RK, Builder, hlslOP, helper.dataLayout); - // CI is replaced in TranslateLoad. + ResLoadHelper ldHelper(CI, RK, RC, handle, IOP); + Type *Ty = CI->getType(); + Value *Ld = nullptr; + if (Ty->isPointerTy()) { + DXASSERT(!DxilResource::IsAnyTexture(RK), + "Textures should not be treated as structured buffers."); + TranslateStructBufSubscript(cast(ldHelper.retVal), handle, + ldHelper.status, hlslOP, RK, DL); + } else if (DXIL::IsRawBuffer(RK)) { + Ld = TranslateBufLoad(ldHelper, RK, Builder, hlslOP, DL); + dxilutil::MigrateDebugValue(CI, Ld); + } else { + TranslateLoad(ldHelper, RK, Builder, hlslOP, DL); + } + // CI is replaced by above translation calls.. return nullptr; } @@ -7937,18 +8035,30 @@ static Value *TranslateRawBufVecLd(Type *VecEltTy, unsigned ElemCount, return Vec; } -Value *TranslateStructBufMatLd(Type *matType, IRBuilder<> &Builder, - Value *handle, hlsl::OP *OP, Value *status, - Value *bufIdx, Value *baseOffset, +Value *TranslateStructBufMatLd(CallInst *CI, IRBuilder<> &Builder, + Value *handle, HLResource::Kind RK, hlsl::OP *OP, + Value *status, Value *bufIdx, Value *baseOffset, const DataLayout &DL) { + + Value *ptr = CI->getArgOperand(HLOperandIndex::kMatLoadPtrOpIdx); + Type *matType = ptr->getType()->getPointerElementType(); HLMatrixType MatTy = HLMatrixType::cast(matType); - Type *EltTy = MatTy.getElementTypeForMem(); - unsigned matSize = MatTy.getNumElements(); - std::vector bufLds; - Value *Vec = + Value *Vec = nullptr; + if (DXIL::IsStructuredBuffer(RK)) { + Type *EltTy = MatTy.getElementTypeForMem(); + unsigned matSize = MatTy.getNumElements(); + std::vector bufLds; + Vec = TranslateRawBufVecLd(EltTy, matSize, Builder, handle, OP, status, bufIdx, baseOffset, DL, bufLds, /*baseAlign (in bytes)*/ 8); - Vec = MatTy.emitLoweredMemToReg(Vec, Builder); + Vec = MatTy.emitLoweredMemToReg(Vec, Builder); + CI->replaceAllUsesWith(Vec); + } else { + ResLoadHelper helper(CI, RK, handle, bufIdx); + helper.Ty = MatTy.getLoweredVectorType(false /*MemRepr*/); + helper.offset = baseOffset; + Vec = TranslateBufLoad(helper, RK, Builder, OP, DL); + } return Vec; } @@ -7991,9 +8101,9 @@ void TranslateStructBufMatSt(Type *matType, IRBuilder<> &Builder, Value *handle, } } -void TranslateStructBufMatLdSt(CallInst *CI, Value *handle, hlsl::OP *OP, - Value *status, Value *bufIdx, Value *baseOffset, - const DataLayout &DL) { +void TranslateStructBufMatLdSt(CallInst *CI, Value *handle, HLResource::Kind RK, + hlsl::OP *OP, Value *status, Value *bufIdx, + Value *baseOffset, const DataLayout &DL) { IRBuilder<> Builder(CI); HLOpcodeGroup group = hlsl::GetHLOpcodeGroupByName(CI->getCalledFunction()); unsigned opcode = GetHLOpcode(CI); @@ -8006,13 +8116,10 @@ void TranslateStructBufMatLdSt(CallInst *CI, Value *handle, hlsl::OP *OP, // orientation. switch (matOp) { case HLMatLoadStoreOpcode::RowMatLoad: - case HLMatLoadStoreOpcode::ColMatLoad: { - Value *ptr = CI->getArgOperand(HLOperandIndex::kMatLoadPtrOpIdx); - Value *NewLd = TranslateStructBufMatLd( - ptr->getType()->getPointerElementType(), Builder, handle, OP, status, - bufIdx, baseOffset, DL); - CI->replaceAllUsesWith(NewLd); - } break; + case HLMatLoadStoreOpcode::ColMatLoad: + TranslateStructBufMatLd(CI, Builder, handle, RK, OP, status, bufIdx, + baseOffset, DL); + break; case HLMatLoadStoreOpcode::RowMatStore: case HLMatLoadStoreOpcode::ColMatStore: { Value *ptr = CI->getArgOperand(HLOperandIndex::kMatStoreDstPtrOpIdx); @@ -8283,57 +8390,65 @@ void TranslateStructBufSubscriptUser(Instruction *user, Value *handle, } userCall->eraseFromParent(); } else if (group == HLOpcodeGroup::HLMatLoadStore) - TranslateStructBufMatLdSt(userCall, handle, OP, status, bufIdx, + // Load/Store matrix within a struct + TranslateStructBufMatLdSt(userCall, handle, ResKind, OP, status, bufIdx, baseOffset, DL); else if (group == HLOpcodeGroup::HLSubscript) { + // Subscript of matrix within a struct TranslateStructBufMatSubscript(userCall, handle, ResKind, bufIdx, baseOffset, status, OP, DL); } - } else if (isa(user) || isa(user)) { - LoadInst *LdInst = dyn_cast(user); - StoreInst *StInst = dyn_cast(user); - - Type *Ty = isa(user) ? LdInst->getType() - : StInst->getValueOperand()->getType(); - Type *pOverloadTy = Ty->getScalarType(); - Value *Offset = baseOffset; - - if (LdInst) { + } else if (LoadInst *ldInst = dyn_cast(user)) { + // Load of scalar/vector within a struct or structured raw load. + if (DXIL::IsStructuredBuffer(ResKind)) { + Type *Ty = ldInst->getType(); unsigned NumComponents = 0; + Value *newLd = nullptr; if (VectorType *VTy = dyn_cast(Ty)) NumComponents = VTy->getNumElements(); else NumComponents = 1; Value *ResultElts[4]; - Constant *Alignment = - OP->GetI32Const(DL.getTypeAllocSize(Ty->getScalarType())); - GenerateRawBufLd(handle, bufIdx, Offset, status, pOverloadTy, ResultElts, - OP, Builder, NumComponents, Alignment); - Value *NewLd = ScalarizeElements(Ty, ResultElts, Builder); - LdInst->replaceAllUsesWith(NewLd); + Constant *alignment = + OP->GetI32Const(DL.getTypeAllocSize(Ty->getScalarType())); + GenerateRawBufLd(handle, bufIdx, baseOffset, status, Ty->getScalarType(), + ResultElts, OP, Builder, NumComponents, alignment); + newLd = ScalarizeElements(Ty, ResultElts, Builder); + + ldInst->replaceAllUsesWith(newLd); } else { - Value *val = StInst->getValueOperand(); - Value *undefVal = llvm::UndefValue::get(pOverloadTy); - Value *vals[] = {undefVal, undefVal, undefVal, undefVal}; - uint8_t mask = 0; - if (Ty->isVectorTy()) { - unsigned vectorNumElements = Ty->getVectorNumElements(); - DXASSERT(vectorNumElements <= 4, "up to 4 elements in vector"); - assert(vectorNumElements <= 4); - for (unsigned i = 0; i < vectorNumElements; i++) { - vals[i] = Builder.CreateExtractElement(val, i); - mask |= (1 << i); - } - } else { - vals[0] = val; - mask = DXIL::kCompMask_X; + ResLoadHelper helper(ldInst, ResKind, handle, bufIdx); + helper.offset = baseOffset; + TranslateBufLoad(helper, ResKind, Builder, OP, DL); + } + ldInst->eraseFromParent(); + } else if (StoreInst *stInst = dyn_cast(user)) { + // Store of scalar/vector within a struct or structured raw store. + Type *Ty = stInst->getValueOperand()->getType(); + Type *pOverloadTy = Ty->getScalarType(); + Value *offset = baseOffset; + + Value *val = stInst->getValueOperand(); + Value *undefVal = llvm::UndefValue::get(pOverloadTy); + Value *vals[] = {undefVal, undefVal, undefVal, undefVal}; + uint8_t mask = 0; + if (Ty->isVectorTy()) { + unsigned vectorNumElements = Ty->getVectorNumElements(); + DXASSERT(vectorNumElements <= 4, "up to 4 elements in vector"); + assert(vectorNumElements <= 4); + for (unsigned i = 0; i < vectorNumElements; i++) { + vals[i] = Builder.CreateExtractElement(val, i); + mask |= (1 << i); } - Constant *alignment = - OP->GetI32Const(DL.getTypeAllocSize(Ty->getScalarType())); - GenerateStructBufSt(handle, bufIdx, Offset, pOverloadTy, OP, Builder, - vals, mask, alignment); + } else { + vals[0] = val; + mask = DXIL::kCompMask_X; } - user->eraseFromParent(); + Constant *alignment = + OP->GetI32Const(DL.getTypeAllocSize(Ty->getScalarType())); + GenerateStructBufSt(handle, bufIdx, offset, pOverloadTy, OP, Builder, vals, + mask, alignment); + stInst->eraseFromParent(); } else if (BitCastInst *BCI = dyn_cast(user)) { // Recurse users for (auto U = BCI->user_begin(); U != BCI->user_end();) { @@ -8368,13 +8483,18 @@ void TranslateStructBufSubscriptUser(Instruction *user, Value *handle, DXASSERT_LOCALVAR(Ty, offset->getType() == Type::getInt32Ty(Ty->getContext()), "else bitness is wrong"); - offset = Builder.CreateAdd(offset, baseOffset); + // Raw buffers can't have defined offsets, apply to index. + if (DXIL::IsRawBuffer(ResKind)) + bufIdx = Builder.CreateAdd(offset, bufIdx); + else + baseOffset = Builder.CreateAdd(offset, baseOffset); for (auto U = GEP->user_begin(); U != GEP->user_end();) { Value *GEPUser = *(U++); TranslateStructBufSubscriptUser(cast(GEPUser), handle, - ResKind, bufIdx, offset, status, OP, DL); + ResKind, bufIdx, baseOffset, status, OP, + DL); } // delete the inst GEP->eraseFromParent(); @@ -8388,13 +8508,12 @@ void TranslateStructBufSubscript(CallInst *CI, Value *handle, Value *status, CI->getArgOperand(HLOperandIndex::kSubscriptIndexOpIdx); Value *bufIdx = nullptr; Value *offset = nullptr; - if (ResKind == HLResource::Kind::RawBuffer) { - offset = subscriptIndex; - } else { + bufIdx = subscriptIndex; + if (ResKind == HLResource::Kind::RawBuffer) + offset = UndefValue::get(Type::getInt32Ty(CI->getContext())); + else // StructuredBuffer, TypedBuffer, etc. - bufIdx = subscriptIndex; offset = OP->GetU32Const(0); - } for (auto U = CI->user_begin(); U != CI->user_end();) { Value *user = *(U++); @@ -8420,6 +8539,7 @@ Value *TranslateTypedBufLoad(CallInst *CI, DXIL::ResourceKind RK, ldHelper.mipLevel = hlslOP->GetU32Const(0); // use ldInst as retVal ldHelper.retVal = ldInst; + ldHelper.Ty = ldInst->getType(); TranslateLoad(ldHelper, RK, Builder, hlslOP, DL); // delete the ld ldInst->eraseFromParent(); @@ -8697,7 +8817,7 @@ void TranslateHLSubscript(CallInst *CI, HLSubscriptOpcode opcode, DXASSERT(CI->hasOneUse(), "subscript should only have one use"); IRBuilder<> Builder(CI); if (LoadInst *ldInst = dyn_cast(*U)) { - ResLoadHelper ldHelper(ldInst, handle, coord, mipLevel); + ResLoadHelper ldHelper(ldInst, RK, handle, coord, mipLevel); TranslateLoad(ldHelper, RK, Builder, hlslOP, helper.dataLayout); ldInst->eraseFromParent(); } else { From d01056be026f27d4fa35fe5565fd0ca8e1a6afdd Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Wed, 12 Feb 2025 17:08:51 -0700 Subject: [PATCH 20/45] Allow structuredbuf load lowering in new load lowering code --- lib/HLSL/HLOperationLower.cpp | 155 ++++++---------------------------- 1 file changed, 24 insertions(+), 131 deletions(-) diff --git a/lib/HLSL/HLOperationLower.cpp b/lib/HLSL/HLOperationLower.cpp index c42ddfc17e..3b3ae3235c 100644 --- a/lib/HLSL/HLOperationLower.cpp +++ b/lib/HLSL/HLOperationLower.cpp @@ -4129,13 +4129,6 @@ Value *GenerateRawBufLd(Value *handle, Value *bufIdx, Value *offset, IRBuilder<> &Builder, unsigned NumComponents, Constant *alignment); -static Value *TranslateRawBufVecLd(Type *VecEltTy, unsigned VecElemCount, - IRBuilder<> &Builder, Value *handle, - hlsl::OP *OP, Value *status, Value *bufIdx, - Value *baseOffset, const DataLayout &DL, - std::vector &bufLds, - unsigned baseAlign, bool isScalarTy = false); - Value *TranslateBufLoad(ResLoadHelper &helper, HLResource::Kind RK, IRBuilder<> &Builder, hlsl::OP *OP, const DataLayout &DL) { @@ -4155,7 +4148,8 @@ Value *TranslateBufLoad(ResLoadHelper &helper, HLResource::Kind RK, EltTy = i32Ty; unsigned EltSize = DL.getTypeAllocSize(EltTy); - unsigned alignment = std::min(4U, EltSize); + unsigned alignment = RK == DxilResource::Kind::RawBuffer ? 4U : 8U; + alignment = std::min(alignment, EltSize); Constant *alignmentVal = OP->GetI32Const(alignment); std::vector elts(numComponents); @@ -4169,6 +4163,7 @@ Value *TranslateBufLoad(ResLoadHelper &helper, HLResource::Kind RK, Args.emplace_back(helper.handle); // resource handle @1 const unsigned kCoordIdx = 2; Args.emplace_back(helper.addr); // coord (may be changed later) @2 + const unsigned kOffsetIdx = 3; Args.emplace_back(helper.offset); // offset (may be changed later) @3 const unsigned kMaskIdx = 4; Args.emplace_back(nullptr); // mask (to be added later) @4 @@ -4193,10 +4188,16 @@ Value *TranslateBufLoad(ResLoadHelper &helper, HLResource::Kind RK, if (!firstLd) firstLd = Ld; - if (i < numComponents) - // Raw buffers can't use offset param. Add to coord index. - Args[kCoordIdx] = - Builder.CreateAdd(Args[kCoordIdx], OP->GetU32Const(4 * EltSize)); + if (i < numComponents) { + if (RK == DxilResource::Kind::RawBuffer) + // Raw buffers can't use offset param. Add to coord index. + Args[kCoordIdx] = + Builder.CreateAdd(Args[kCoordIdx], OP->GetU32Const(4 * EltSize)); + else + // Structured buffers increment the offset parameter. + Args[kOffsetIdx] = + Builder.CreateAdd(Args[kOffsetIdx], OP->GetU32Const(4 * EltSize)); + } } Value *retValNew = ScalarizeElements(Ty, elts, Builder); @@ -4204,7 +4205,7 @@ Value *TranslateBufLoad(ResLoadHelper &helper, HLResource::Kind RK, DXASSERT(firstLd, "No loads created by TranslateBufLoad"); if (isBool) { - // Convert bool result back to register representation. + // Convert result back to register representation. retValNew = Builder.CreateICmpNE( retValNew, Constant::getNullValue(retValNew->getType())); } @@ -4230,34 +4231,6 @@ void TranslateLoad(ResLoadHelper &helper, HLResource::Kind RK, numComponents = Ty->getVectorNumElements(); } - if (DXIL::IsStructuredBuffer(RK)) { - std::vector bufLds; - const bool isBool = EltTy->isIntegerTy(1); - - // Bool are represented as i32 in memory - Type *MemReprTy = isBool ? Builder.getInt32Ty() : EltTy; - bool isScalarTy = !Ty->isVectorTy(); - - Value *retValNew = nullptr; - retValNew = TranslateRawBufVecLd( - MemReprTy, numComponents, Builder, helper.handle, OP, helper.status, - helper.addr, OP->GetU32Const(0), DL, bufLds, - /*baseAlign (in bytes)*/ 8, isScalarTy); - - DXASSERT_NOMSG(!bufLds.empty()); - dxilutil::MigrateDebugValue(helper.retVal, bufLds.front()); - - if (isBool) { - // Convert result back to register representation. - retValNew = Builder.CreateICmpNE( - retValNew, Constant::getNullValue(retValNew->getType())); - } - - helper.retVal->replaceAllUsesWith(retValNew); - helper.retVal = retValNew; - return; - } - bool isTyped = opcode == OP::OpCode::TextureLoad || RK == DxilResource::Kind::TypedBuffer; bool is64 = EltTy == i64Ty || EltTy == doubleTy; @@ -4359,7 +4332,7 @@ void TranslateLoad(ResLoadHelper &helper, HLResource::Kind RK, } if (isBool) { - // Convert result back to register representation. + // Convert bool result back to register representation. retValNew = Builder.CreateICmpNE( retValNew, Constant::getNullValue(retValNew->getType())); } @@ -4393,7 +4366,7 @@ Value *TranslateResourceLoad(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, "Textures should not be treated as structured buffers."); TranslateStructBufSubscript(cast(ldHelper.retVal), handle, ldHelper.status, hlslOP, RK, DL); - } else if (DXIL::IsRawBuffer(RK)) { + } else if (DXIL::IsRawBuffer(RK) || DXIL::IsStructuredBuffer(RK)) { Ld = TranslateBufLoad(ldHelper, RK, Builder, hlslOP, DL); dxilutil::MigrateDebugValue(CI, Ld); } else { @@ -7985,56 +7958,6 @@ void GenerateStructBufSt(Value *handle, Value *bufIdx, Value *offset, Builder.CreateCall(dxilF, Args); } -static Value *TranslateRawBufVecLd(Type *VecEltTy, unsigned ElemCount, - IRBuilder<> &Builder, Value *handle, - hlsl::OP *OP, Value *status, Value *bufIdx, - Value *baseOffset, const DataLayout &DL, - std::vector &bufLds, - unsigned baseAlign, bool isScalarTy) { - - unsigned EltSize = DL.getTypeAllocSize(VecEltTy); - unsigned alignment = std::min(baseAlign, EltSize); - Constant *alignmentVal = OP->GetI32Const(alignment); - - if (baseOffset == nullptr) { - baseOffset = OP->GetU32Const(0); - } - - std::vector elts(ElemCount); - unsigned rest = (ElemCount % 4); - for (unsigned i = 0; i < ElemCount - rest; i += 4) { - Value *ResultElts[4]; - Value *bufLd = - GenerateRawBufLd(handle, bufIdx, baseOffset, status, VecEltTy, - ResultElts, OP, Builder, 4, alignmentVal); - bufLds.emplace_back(bufLd); - elts[i] = ResultElts[0]; - elts[i + 1] = ResultElts[1]; - elts[i + 2] = ResultElts[2]; - elts[i + 3] = ResultElts[3]; - - baseOffset = Builder.CreateAdd(baseOffset, OP->GetU32Const(4 * EltSize)); - } - - if (rest) { - Value *ResultElts[4]; - Value *bufLd = - GenerateRawBufLd(handle, bufIdx, baseOffset, status, VecEltTy, - ResultElts, OP, Builder, rest, alignmentVal); - bufLds.emplace_back(bufLd); - for (unsigned i = 0; i < rest; i++) - elts[ElemCount - rest + i] = ResultElts[i]; - } - - // If the expected return type is scalar then skip building a vector - if (isScalarTy) { - return elts[0]; - } - - Value *Vec = HLMatrixLower::BuildVector(VecEltTy, elts, Builder); - return Vec; -} - Value *TranslateStructBufMatLd(CallInst *CI, IRBuilder<> &Builder, Value *handle, HLResource::Kind RK, hlsl::OP *OP, Value *status, Value *bufIdx, Value *baseOffset, @@ -8043,23 +7966,10 @@ Value *TranslateStructBufMatLd(CallInst *CI, IRBuilder<> &Builder, Value *ptr = CI->getArgOperand(HLOperandIndex::kMatLoadPtrOpIdx); Type *matType = ptr->getType()->getPointerElementType(); HLMatrixType MatTy = HLMatrixType::cast(matType); - Value *Vec = nullptr; - if (DXIL::IsStructuredBuffer(RK)) { - Type *EltTy = MatTy.getElementTypeForMem(); - unsigned matSize = MatTy.getNumElements(); - std::vector bufLds; - Vec = - TranslateRawBufVecLd(EltTy, matSize, Builder, handle, OP, status, bufIdx, - baseOffset, DL, bufLds, /*baseAlign (in bytes)*/ 8); - Vec = MatTy.emitLoweredMemToReg(Vec, Builder); - CI->replaceAllUsesWith(Vec); - } else { - ResLoadHelper helper(CI, RK, handle, bufIdx); - helper.Ty = MatTy.getLoweredVectorType(false /*MemRepr*/); - helper.offset = baseOffset; - Vec = TranslateBufLoad(helper, RK, Builder, OP, DL); - } - return Vec; + ResLoadHelper helper(CI, RK, handle, bufIdx); + helper.Ty = MatTy.getLoweredVectorType(false /*MemRepr*/); + helper.offset = baseOffset; + return TranslateBufLoad(helper, RK, Builder, OP, DL); } void TranslateStructBufMatSt(Type *matType, IRBuilder<> &Builder, Value *handle, @@ -8400,27 +8310,10 @@ void TranslateStructBufSubscriptUser(Instruction *user, Value *handle, } } else if (LoadInst *ldInst = dyn_cast(user)) { // Load of scalar/vector within a struct or structured raw load. - if (DXIL::IsStructuredBuffer(ResKind)) { - Type *Ty = ldInst->getType(); - unsigned NumComponents = 0; - Value *newLd = nullptr; - if (VectorType *VTy = dyn_cast(Ty)) - NumComponents = VTy->getNumElements(); - else - NumComponents = 1; - Value *ResultElts[4]; - Constant *alignment = - OP->GetI32Const(DL.getTypeAllocSize(Ty->getScalarType())); - GenerateRawBufLd(handle, bufIdx, baseOffset, status, Ty->getScalarType(), - ResultElts, OP, Builder, NumComponents, alignment); - newLd = ScalarizeElements(Ty, ResultElts, Builder); - - ldInst->replaceAllUsesWith(newLd); - } else { - ResLoadHelper helper(ldInst, ResKind, handle, bufIdx); - helper.offset = baseOffset; - TranslateBufLoad(helper, ResKind, Builder, OP, DL); - } + ResLoadHelper helper(ldInst, ResKind, handle, bufIdx); + helper.offset = baseOffset; + TranslateBufLoad(helper, ResKind, Builder, OP, DL); + ldInst->eraseFromParent(); } else if (StoreInst *stInst = dyn_cast(user)) { // Store of scalar/vector within a struct or structured raw store. From 5061d8c584eb8cee77fc64454b0b06b834b67d9f Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Mon, 10 Mar 2025 01:51:26 -0600 Subject: [PATCH 21/45] Refactor resloadhelper constructors the default offset behavior for non-call instructions was different in every location so making it explicit and letting each call location calculate it as appropriate cleaned things up. It turns out the only case of matrix loading where the type was thought to be different from the type of the value to replace was always the same, so the type member is removed. The only case where offset calculation was different for the call instruction constructor was also where the replaced instruction needed to be explicit, so the boolean parameter was replaced by the explicit replacement instruction which sets that boolean and explicitly sets the replaced instruction to either the matrix load instruction or a load instruction of the result of a subscript operator. --- lib/HLSL/HLOperationLower.cpp | 60 +++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/lib/HLSL/HLOperationLower.cpp b/lib/HLSL/HLOperationLower.cpp index 3b3ae3235c..efd239e101 100644 --- a/lib/HLSL/HLOperationLower.cpp +++ b/lib/HLSL/HLOperationLower.cpp @@ -3962,20 +3962,14 @@ struct ResLoadHelper { // Default constructor uses CI load intrinsic call // to get the retval and various location indicators. ResLoadHelper(CallInst *CI, DxilResource::Kind RK, DxilResourceBase::Class RC, - Value *h, IntrinsicOp IOP, bool bForSubscript = false); + Value *h, IntrinsicOp IOP, LoadInst *TyBufSubLoad = nullptr); // Alternative constructor explicitly sets the index. // Used for some subscript operators. ResLoadHelper(Instruction *ldInst, DxilResource::Kind RK, Value *h, - Value *idx, Value *mip = nullptr) + Value *idx, Value *Offset, Value *mip = nullptr) : intrinsicOpCode(IntrinsicOp::Num_Intrinsics), handle(h), retVal(ldInst), - addr(idx), offset(nullptr), status(nullptr), mipLevel(mip) { + addr(idx), offset(Offset), status(nullptr), mipLevel(mip) { opcode = LoadOpFromResKind(RK); - Type *i32Ty = IRBuilder<>(ldInst).getInt32Ty(); - if (DXIL::IsStructuredBuffer(RK)) - offset = ConstantInt::get(i32Ty, 0U); - else - offset = UndefValue::get(i32Ty); - Ty = ldInst->getType(); } OP::OpCode opcode; IntrinsicOp intrinsicOpCode; @@ -3987,16 +3981,25 @@ struct ResLoadHelper { Value *offset; Value *status; Value *mipLevel; - Type *Ty; }; +// Uses CI arguments to determine the index, offset, and mipLevel also depending +// on the RK/RC resource kind and class, which determine the opcode. +// Handle and IOP are set explicitly. +// For typed buffer loads, the call instruction feeds into a load +// represented by TyBufSubLoad which determines the instruction to replace. +// Otherwise, CI is replaced. ResLoadHelper::ResLoadHelper(CallInst *CI, DxilResource::Kind RK, DxilResourceBase::Class RC, Value *hdl, - IntrinsicOp IOP, bool bForSubscript) + IntrinsicOp IOP, LoadInst *TyBufSubLoad) : intrinsicOpCode(IOP), handle(hdl), offset(nullptr), status(nullptr) { opcode = LoadOpFromResKind(RK); - retVal = CI; - Ty = CI->getType(); + bool bForSubscript = false; + if (TyBufSubLoad) { + bForSubscript = true; + retVal = TyBufSubLoad; + } else + retVal = CI; const unsigned kAddrIdx = HLOperandIndex::kBufLoadAddrOpIdx; addr = CI->getArgOperand(kAddrIdx); unsigned argc = CI->getNumArgOperands(); @@ -4132,8 +4135,7 @@ Value *GenerateRawBufLd(Value *handle, Value *bufIdx, Value *offset, Value *TranslateBufLoad(ResLoadHelper &helper, HLResource::Kind RK, IRBuilder<> &Builder, hlsl::OP *OP, const DataLayout &DL) { - // Collect information about the resource type. - Type *Ty = helper.Ty; + Type *Ty = helper.retVal->getType(); Type *EltTy = Ty->getScalarType(); unsigned numComponents = 1; @@ -7963,12 +7965,15 @@ Value *TranslateStructBufMatLd(CallInst *CI, IRBuilder<> &Builder, Value *status, Value *bufIdx, Value *baseOffset, const DataLayout &DL) { + ResLoadHelper helper(CI, RK, handle, bufIdx, baseOffset); +#ifndef NDEBUG Value *ptr = CI->getArgOperand(HLOperandIndex::kMatLoadPtrOpIdx); Type *matType = ptr->getType()->getPointerElementType(); HLMatrixType MatTy = HLMatrixType::cast(matType); - ResLoadHelper helper(CI, RK, handle, bufIdx); - helper.Ty = MatTy.getLoweredVectorType(false /*MemRepr*/); - helper.offset = baseOffset; + DXASSERT(MatTy.getLoweredVectorType(false /*MemRepr*/) == + helper.retVal->getType(), + "helper type should match vectorized matrix"); +#endif return TranslateBufLoad(helper, RK, Builder, OP, DL); } @@ -8308,13 +8313,12 @@ void TranslateStructBufSubscriptUser(Instruction *user, Value *handle, TranslateStructBufMatSubscript(userCall, handle, ResKind, bufIdx, baseOffset, status, OP, DL); } - } else if (LoadInst *ldInst = dyn_cast(user)) { + } else if (LoadInst *LdInst = dyn_cast(user)) { // Load of scalar/vector within a struct or structured raw load. - ResLoadHelper helper(ldInst, ResKind, handle, bufIdx); - helper.offset = baseOffset; + ResLoadHelper helper(LdInst, ResKind, handle, bufIdx, baseOffset); TranslateBufLoad(helper, ResKind, Builder, OP, DL); - ldInst->eraseFromParent(); + LdInst->eraseFromParent(); } else if (StoreInst *stInst = dyn_cast(user)) { // Store of scalar/vector within a struct or structured raw store. Type *Ty = stInst->getValueOperand()->getType(); @@ -8424,15 +8428,14 @@ Value *TranslateTypedBufLoad(CallInst *CI, DXIL::ResourceKind RK, DXIL::ResourceClass RC, Value *handle, LoadInst *ldInst, IRBuilder<> &Builder, hlsl::OP *hlslOP, const DataLayout &DL) { - ResLoadHelper ldHelper(CI, RK, RC, handle, IntrinsicOp::MOP_Load, - /*bForSubscript*/ true); + + // The arguments to the call instruction are used to determine the access, + // the return value and type come from the load instruction. + ResLoadHelper ldHelper(CI, RK, RC, handle, IntrinsicOp::MOP_Load, ldInst); // Default sampleIdx for 2DMS textures. if (RK == DxilResource::Kind::Texture2DMS || RK == DxilResource::Kind::Texture2DMSArray) ldHelper.mipLevel = hlslOP->GetU32Const(0); - // use ldInst as retVal - ldHelper.retVal = ldInst; - ldHelper.Ty = ldInst->getType(); TranslateLoad(ldHelper, RK, Builder, hlslOP, DL); // delete the ld ldInst->eraseFromParent(); @@ -8710,7 +8713,8 @@ void TranslateHLSubscript(CallInst *CI, HLSubscriptOpcode opcode, DXASSERT(CI->hasOneUse(), "subscript should only have one use"); IRBuilder<> Builder(CI); if (LoadInst *ldInst = dyn_cast(*U)) { - ResLoadHelper ldHelper(ldInst, RK, handle, coord, mipLevel); + Value *Offset = UndefValue::get(Builder.getInt32Ty()); + ResLoadHelper ldHelper(ldInst, RK, handle, coord, Offset, mipLevel); TranslateLoad(ldHelper, RK, Builder, hlslOP, helper.dataLayout); ldInst->eraseFromParent(); } else { From 92872991c32888a207905c97ef9c7c4495de5a0e Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Mon, 10 Mar 2025 01:01:30 -0600 Subject: [PATCH 22/45] add scalars test for load/store --- .../buffer-load-stores-scalars.hlsl | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 tools/clang/test/CodeGenDXIL/hlsl/intrinsics/buffer-load-stores-scalars.hlsl diff --git a/tools/clang/test/CodeGenDXIL/hlsl/intrinsics/buffer-load-stores-scalars.hlsl b/tools/clang/test/CodeGenDXIL/hlsl/intrinsics/buffer-load-stores-scalars.hlsl new file mode 100644 index 0000000000..03735cb968 --- /dev/null +++ b/tools/clang/test/CodeGenDXIL/hlsl/intrinsics/buffer-load-stores-scalars.hlsl @@ -0,0 +1,162 @@ +// RUN: %dxc -DTYPE=float -T vs_6_6 %s | FileCheck %s +// RUN: %dxc -DTYPE=bool -T vs_6_6 %s | FileCheck %s --check-prefixes=CHECK,I1 +// RUN: %dxc -DTYPE=uint64_t -T vs_6_6 %s | FileCheck %s --check-prefixes=CHECK,I64 +// RUN: %dxc -DTYPE=double -T vs_6_6 %s | FileCheck %s --check-prefixes=CHECK,F64 + +// RUN: %dxc -DTYPE=float1 -T vs_6_6 %s | FileCheck %s +// RUN: %dxc -DTYPE=bool1 -T vs_6_6 %s | FileCheck %s --check-prefixes=CHECK,I1 +// RUN: %dxc -DTYPE=uint64_t1 -T vs_6_6 %s | FileCheck %s --check-prefixes=CHECK,I64 +// RUN: %dxc -DTYPE=double1 -T vs_6_6 %s | FileCheck %s --check-prefixes=CHECK,F64 + +// Confirm that 6.9 doesn't use vector loads for scalars and vec1s +// RUN: %dxc -DTYPE=float -T vs_6_9 %s | FileCheck %s +// RUN: %dxc -DTYPE=bool -T vs_6_9 %s | FileCheck %s --check-prefixes=CHECK,I1 +// RUN: %dxc -DTYPE=uint64_t -T vs_6_9 %s | FileCheck %s --check-prefixes=CHECK,I64 +// RUN: %dxc -DTYPE=double -T vs_6_9 %s | FileCheck %s --check-prefixes=CHECK,F64 + +// RUN: %dxc -DTYPE=float1 -T vs_6_9 %s | FileCheck %s +// RUiN: %dxc -DTYPE=bool1 -T vs_6_9 %s | FileCheck %s --check-prefixes=CHECK,I1 +// RUN: %dxc -DTYPE=uint64_t1 -T vs_6_9 %s | FileCheck %s --check-prefixes=CHECK,I64 +// RUN: %dxc -DTYPE=double1 -T vs_6_9 %s | FileCheck %s --check-prefixes=CHECK,F64 + +/////////////////////////////////////////////////////////////////////// +// Test codegen for various load and store operations and conversions +// for different scalar buffer types and confirm that the proper +// loads, stores, and conversion operations take place. +/////////////////////////////////////////////////////////////////////// + + +// These -DAGs must match the same line. That is the only reason for the -DAG. +// The first match will assign [[TY]] to the native type +// For most runs, the second match will assign [[TY32]] to the same thing. +// For 64-bit types, the memory representation is i32 and a separate variable is needed. +// For these cases, there is another line that will always match i32. +// This line will also force the previous -DAGs to match the same line since the most +// This shader can produce is two ResRet types. +// CHECK-DAG: %dx.types.ResRet.[[TY:[a-z][0-9][0-9]]] = type { [[TYPE:[a-z0-9]*]], +// CHECK-DAG: %dx.types.ResRet.[[TY32:[a-z][0-9][0-9]]] = type { [[TYPE]], +// I64: %dx.types.ResRet.[[TY32:i32]] +// F64: %dx.types.ResRet.[[TY32:i32]] + + ByteAddressBuffer RoByBuf : register(t1); +RWByteAddressBuffer RwByBuf : register(u1); + + StructuredBuffer< TYPE > RoStBuf : register(t2); +RWStructuredBuffer< TYPE > RwStBuf : register(u2); + + Buffer< TYPE > RoTyBuf : register(t3); +RWBuffer< TYPE > RwTyBuf : register(u3); + +ConsumeStructuredBuffer CnStBuf : register(u4); +AppendStructuredBuffer ApStBuf : register(u5); + +void main(uint ix[2] : IX) { + // ByteAddressBuffer Tests + + // CHECK-DAG: [[HDLROBY:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 1, i32 1, i32 0, i8 0 }, i32 1, i1 false) + // CHECK-DAG: [[HDLRWBY:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 1, i32 1, i32 0, i8 1 }, i32 1, i1 false) + + // CHECK-DAG: [[HDLROST:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 2, i32 2, i32 0, i8 0 }, i32 2, i1 false) + // CHECK-DAG: [[HDLRWST:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 2, i32 2, i32 0, i8 1 }, i32 2, i1 false) + + // CHECK-DAG: [[HDLROTY:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 3, i32 3, i32 0, i8 0 }, i32 3, i1 false) + // CHECK-DAG: [[HDLRWTY:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 3, i32 3, i32 0, i8 1 }, i32 3, i1 false) + + // CHECK-DAG: [[HDLCON:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 4, i32 4, i32 0, i8 1 }, i32 4, i1 false) + // CHECK-DAG: [[HDLAPP:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 5, i32 5, i32 0, i8 1 }, i32 5, i1 false) + + // CHECK: [[IX0:%.*]] = call i32 @dx.op.loadInput.i32(i32 4, + + // CHECK: [[ANHDLRWBY:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLRWBY]] + // CHECK: call %dx.types.ResRet.[[TY]] @dx.op.rawBufferLoad.[[TY]](i32 139, %dx.types.Handle [[ANHDLRWBY]], i32 [[IX0]] + // I1: icmp ne i32 %{{.*}}, 0 + TYPE babElt1 = RwByBuf.Load< TYPE >(ix[0]); + + // CHECK: [[ANHDLROBY:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLROBY]] + // CHECK: call %dx.types.ResRet.[[TY]] @dx.op.rawBufferLoad.[[TY]](i32 139, %dx.types.Handle [[ANHDLROBY]], i32 [[IX0]] + // I1: icmp ne i32 %{{.*}}, 0 + TYPE babElt2 = RoByBuf.Load< TYPE >(ix[0]); + + // I1: zext i1 %{{.*}} to i32 + // CHECK: all void @dx.op.rawBufferStore.[[TY]](i32 140, %dx.types.Handle [[ANHDLRWBY]], i32 [[IX0]] + RwByBuf.Store< TYPE >(ix[0], babElt1 + babElt2); + + // StructuredBuffer Tests + // CHECK: [[ANHDLRWST:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLRWST]] + // CHECK: call %dx.types.ResRet.[[TY]] @dx.op.rawBufferLoad.[[TY]](i32 139, %dx.types.Handle [[ANHDLRWST]], i32 [[IX0]] + // I1: icmp ne i32 %{{.*}}, 0 + TYPE stbElt1 = RwStBuf.Load(ix[0]); + // CHECK: [[IX1:%.*]] = call i32 @dx.op.loadInput.i32(i32 4, + // CHECK: call %dx.types.ResRet.[[TY]] @dx.op.rawBufferLoad.[[TY]](i32 139, %dx.types.Handle [[ANHDLRWST]], i32 [[IX1]] + // I1: icmp ne i32 %{{.*}}, 0 + TYPE stbElt2 = RwStBuf[ix[1]]; + + // CHECK: [[ANHDLROST:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLROST]] + // CHECK: call %dx.types.ResRet.[[TY]] @dx.op.rawBufferLoad.[[TY]](i32 139, %dx.types.Handle [[ANHDLROST]], i32 [[IX0]] + // I1: icmp ne i32 %{{.*}}, 0 + TYPE stbElt3 = RoStBuf.Load(ix[0]); + // CHECK: call %dx.types.ResRet.[[TY]] @dx.op.rawBufferLoad.[[TY]](i32 139, %dx.types.Handle [[ANHDLROST]], i32 [[IX1]] + // I1: icmp ne i32 %{{.*}}, 0 + TYPE stbElt4 = RoStBuf[ix[1]]; + + // I1: zext i1 %{{.*}} to i32 + // CHECK: all void @dx.op.rawBufferStore.[[TY]](i32 140, %dx.types.Handle [[ANHDLRWST]], i32 [[IX0]] + RwStBuf[ix[0]] = stbElt1 + stbElt2 + stbElt3 + stbElt4; + + // {Append/Consume}StructuredBuffer Tests + // CHECK: [[ANHDLCON:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLCON]] + // CHECK: [[CONIX:%.*]] = call i32 @dx.op.bufferUpdateCounter(i32 70, %dx.types.Handle [[ANHDLCON]], i8 -1) + // CHECK: call %dx.types.ResRet.[[TY]] @dx.op.rawBufferLoad.[[TY]](i32 139, %dx.types.Handle [[ANHDLCON]], i32 [[CONIX]] + // I1: icmp ne i32 %{{.*}}, 0 + TYPE cnElt = CnStBuf.Consume(); + + // CHECK: [[ANHDLAPP:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLAPP]] + // CHECK: [[APPIX:%.*]] = call i32 @dx.op.bufferUpdateCounter(i32 70, %dx.types.Handle [[ANHDLAPP]], i8 1) + // I1: zext i1 %{{.*}} to i32 + // CHECK: all void @dx.op.rawBufferStore.[[TY]](i32 140, %dx.types.Handle [[ANHDLAPP]], i32 [[APPIX]] + ApStBuf.Append(cnElt); + + // TypedBuffer Tests + // CHECK: [[ANHDLRWTY:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLRWTY]] + // CHECK: call %dx.types.ResRet.[[TY32]] @dx.op.bufferLoad.[[TY32]](i32 68, %dx.types.Handle [[ANHDLRWTY]], i32 [[IX0]] + // F64: call double @dx.op.makeDouble.f64(i32 101 + // I64: zext i32 %{{.*}} to i64 + // I64: zext i32 %{{.*}} to i64 + // I64: shl nuw i64 + // I64: or i64 + // I1: icmp ne i32 %{{.*}}, 0 + TYPE typElt1 = RwTyBuf.Load(ix[0]); + // CHECK: call %dx.types.ResRet.[[TY32]] @dx.op.bufferLoad.[[TY32]](i32 68, %dx.types.Handle [[ANHDLRWTY]], i32 [[IX1]] + // F64: call double @dx.op.makeDouble.f64(i32 101 + // I64: zext i32 %{{.*}} to i64 + // I64: zext i32 %{{.*}} to i64 + // I64: shl nuw i64 + // I64: or i64 + // I1: icmp ne i32 %{{.*}}, 0 + TYPE typElt2 = RwTyBuf[ix[1]]; + // CHECK: [[ANHDLROTY:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLROTY]] + // CHECK: call %dx.types.ResRet.[[TY32]] @dx.op.bufferLoad.[[TY32]](i32 68, %dx.types.Handle [[ANHDLROTY]], i32 [[IX0]] + // F64: call double @dx.op.makeDouble.f64(i32 101 + // I64: zext i32 %{{.*}} to i64 + // I64: zext i32 %{{.*}} to i64 + // I64: shl nuw i64 + // I64: or i64 + // I1: icmp ne i32 %{{.*}}, 0 + TYPE typElt3 = RoTyBuf.Load(ix[0]); + // CHECK: call %dx.types.ResRet.[[TY32]] @dx.op.bufferLoad.[[TY32]](i32 68, %dx.types.Handle [[ANHDLROTY]], i32 [[IX1]] + // F64: call double @dx.op.makeDouble.f64(i32 101 + // I64: zext i32 %{{.*}} to i64 + // I64: zext i32 %{{.*}} to i64 + // I64: shl nuw i64 + // I64: or i64 + // I1: icmp ne i32 %{{.*}}, 0 + TYPE typElt4 = RoTyBuf[ix[1]]; + + // F64: call %dx.types.splitdouble @dx.op.splitDouble.f64(i32 102 + // I64: trunc i64 %{{.*}} to i32 + // I64: lshr i64 %{{.*}}, 32 + // I64: trunc i64 %{{.*}} to i32 + // I1: zext i1 %{{.*}} to i32 + // CHECK: all void @dx.op.bufferStore.[[TY32]](i32 69, %dx.types.Handle [[ANHDLRWTY]], i32 [[IX0]] + RwTyBuf[ix[0]] = typElt1 + typElt2 + typElt3 + typElt4; +} From 92b861e4d6b08edccc18a50a70ffa5e855f291e2 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Thu, 13 Feb 2025 01:32:02 -0700 Subject: [PATCH 23/45] Typed buf load lowering in new load lowering code making the translateresourcebuffer call into the correct buffer lowererer Adapt resloadhelper to set miplevel correctly for MS textures Rename some typed buffer load utility functions. With recent changes to load lowering, these function names are misleading implying that they are used for loads instead of just subscript operators or that they are used more broadly than just for typed buffers. Add testing for texture load/stores. move arg collection to separate function to better enable iteration control and handle the complicated typed buf arguments --- lib/HLSL/HLOperationLower.cpp | 358 ++++++++---------- .../hlsl/intrinsics/buffer-load-stores.hlsl | 189 +++++++-- 2 files changed, 324 insertions(+), 223 deletions(-) diff --git a/lib/HLSL/HLOperationLower.cpp b/lib/HLSL/HLOperationLower.cpp index efd239e101..2b397382b9 100644 --- a/lib/HLSL/HLOperationLower.cpp +++ b/lib/HLSL/HLOperationLower.cpp @@ -4032,8 +4032,9 @@ ResLoadHelper::ResLoadHelper(CallInst *CI, DxilResource::Kind RK, RK == DxilResource::Kind::Texture2DMSArray) { offsetIdx = HLOperandIndex::kTex2DMSLoadOffsetOpIdx; statusIdx = HLOperandIndex::kTex2DMSLoadStatusOpIdx; - mipLevel = - CI->getArgOperand(HLOperandIndex::kTex2DMSLoadSampleIdxOpIdx); + if (!bForSubscript) + mipLevel = + CI->getArgOperand(HLOperandIndex::kTex2DMSLoadSampleIdxOpIdx); } if (argc > offsetIdx) @@ -4045,7 +4046,12 @@ ResLoadHelper::ResLoadHelper(CallInst *CI, DxilResource::Kind RK, (RK == DxilResource::Kind::Texture2DMS || RK == DxilResource::Kind::Texture2DMSArray)) { unsigned statusIdx = HLOperandIndex::kTex2DMSLoadStatusOpIdx; - mipLevel = CI->getArgOperand(HLOperandIndex::kTex2DMSLoadSampleIdxOpIdx); + + if (!bForSubscript) + mipLevel = + CI->getArgOperand(HLOperandIndex::kTex2DMSLoadSampleIdxOpIdx); + else + mipLevel = IRBuilder<>(CI).getInt32(0); if (argc > statusIdx) status = CI->getArgOperand(statusIdx); @@ -4072,35 +4078,6 @@ void TranslateStructBufSubscript(CallInst *CI, Value *handle, Value *status, hlsl::OP *OP, HLResource::Kind RK, const DataLayout &DL); -// Create { v0, v1 } from { v0.lo, v0.hi, v1.lo, v1.hi } -void Make64bitResultForLoad(Type *EltTy, ArrayRef resultElts32, - unsigned size, MutableArrayRef resultElts, - hlsl::OP *hlslOP, IRBuilder<> &Builder) { - Type *i64Ty = Builder.getInt64Ty(); - Type *doubleTy = Builder.getDoubleTy(); - if (EltTy == doubleTy) { - Function *makeDouble = - hlslOP->GetOpFunc(DXIL::OpCode::MakeDouble, doubleTy); - Value *makeDoubleOpArg = - Builder.getInt32((unsigned)DXIL::OpCode::MakeDouble); - for (unsigned i = 0; i < size; i++) { - Value *lo = resultElts32[2 * i]; - Value *hi = resultElts32[2 * i + 1]; - Value *V = Builder.CreateCall(makeDouble, {makeDoubleOpArg, lo, hi}); - resultElts[i] = V; - } - } else { - for (unsigned i = 0; i < size; i++) { - Value *lo = resultElts32[2 * i]; - Value *hi = resultElts32[2 * i + 1]; - lo = Builder.CreateZExt(lo, i64Ty); - hi = Builder.CreateZExt(hi, i64Ty); - hi = Builder.CreateShl(hi, 32); - resultElts[i] = Builder.CreateOr(lo, hi); - } - } -} - static Constant *GetRawBufferMaskForETy(Type *Ty, unsigned NumComponents, hlsl::OP *OP) { unsigned mask = 0; @@ -4132,57 +4109,122 @@ Value *GenerateRawBufLd(Value *handle, Value *bufIdx, Value *offset, IRBuilder<> &Builder, unsigned NumComponents, Constant *alignment); +static Value *GenerateBufLd(hlsl::OP *OP, IRBuilder<> &Builder, + OP::OpCode opcode, Type *EltTy, + unsigned NumElements, ArrayRef Args, + std::vector::iterator EltIt); + +// Sets up arguments for buffer load call. +static SmallVector GetBufLoadArgs(ResLoadHelper helper, + HLResource::Kind RK, + IRBuilder<> Builder, Type *EltTy, + unsigned EltSize) { + OP::OpCode opcode = helper.opcode; + llvm::Constant *opArg = Builder.getInt32((uint32_t)opcode); + + unsigned alignment = RK == DxilResource::Kind::RawBuffer ? 4U : 8U; + alignment = std::min(alignment, EltSize); + Constant *alignmentVal = Builder.getInt32(alignment); + + // Assemble args is specific to the type bab/struct/typed + // Typed needs to handle the possibility of vector coords + // Raws need to calculate alignment and mask values. + SmallVector Args; + Args.emplace_back(opArg); // opcode @0 + Args.emplace_back(helper.handle); // resource handle @1 + + // Set offsets appropriate for the load operation. + bool isVectorAddr = helper.addr->getType()->isVectorTy(); + if (opcode == OP::OpCode::TextureLoad) { + llvm::Value *undefI = llvm::UndefValue::get(Builder.getInt32Ty()); + + // Set mip level or sample for MS texutures @3. + Args.emplace_back(helper.mipLevel); + // Set texture coords according to resource kind @4-6 + // Coords unused by the resource kind are undefs. + unsigned coordSize = DxilResource::GetNumCoords(RK); + for (unsigned i = 0; i < 3; i++) { + if (i < coordSize) { + Args.emplace_back(isVectorAddr + ? Builder.CreateExtractElement(helper.addr, i) + : helper.addr); + } else + Args.emplace_back(undefI); + } + // Set texture offsets according to resource kind @7-9 + // Coords unused by the resource kind are undefs. + unsigned offsetSize = DxilResource::GetNumOffsets(RK); + if (!helper.offset || isa(helper.offset)) + offsetSize = 0; + for (unsigned i = 0; i < 3; i++) { + if (i < offsetSize) + Args.emplace_back(Builder.CreateExtractElement(helper.offset, i)); + else + Args.emplace_back(undefI); + } + } else { + // coord (may be changed later) @2 + Args.emplace_back( + isVectorAddr ? Builder.CreateExtractElement(helper.addr, (uint64_t)0) + : helper.addr); + Args.emplace_back(helper.offset); // offset (may be changed later) @3 + if (opcode == OP::OpCode::RawBufferLoad) { + // Unlike typed buffer load, raw buffer load has mask and alignment. + Args.emplace_back(nullptr); // mask (to be added later) @4 + Args.emplace_back(alignmentVal); // alignment @5 + } + } + return Args; +} + +// Emits as many calls as needed to load the full vector +// Performs any needed extractions and conversions of the results. Value *TranslateBufLoad(ResLoadHelper &helper, HLResource::Kind RK, IRBuilder<> &Builder, hlsl::OP *OP, const DataLayout &DL) { Type *Ty = helper.retVal->getType(); Type *EltTy = Ty->getScalarType(); unsigned numComponents = 1; - if (Ty->isVectorTy()) { numComponents = Ty->getVectorNumElements(); } Type *i32Ty = Builder.getInt32Ty(); + Type *i64Ty = Builder.getInt64Ty(); + Type *doubleTy = Builder.getDoubleTy(); + const bool isTyped = DXIL::IsTyped(RK); + const bool is64 = (EltTy == i64Ty || EltTy == doubleTy); const bool isBool = EltTy->isIntegerTy(1); - if (isBool) + if (isBool || (is64 && isTyped)) // Value will be loaded in its memory representation. EltTy = i32Ty; - unsigned EltSize = DL.getTypeAllocSize(EltTy); - unsigned alignment = RK == DxilResource::Kind::RawBuffer ? 4U : 8U; - alignment = std::min(alignment, EltSize); - Constant *alignmentVal = OP->GetI32Const(alignment); std::vector elts(numComponents); OP::OpCode opcode = helper.opcode; - Function *F = OP->GetOpFunc(opcode, EltTy); - llvm::Constant *opArg = OP->GetU32Const((unsigned)opcode); - // Assemble args appropriate to the load being lowered. - SmallVector Args; - Args.emplace_back(opArg); // opcode @0 - Args.emplace_back(helper.handle); // resource handle @1 + SmallVector Args = + GetBufLoadArgs(helper, RK, Builder, EltTy, EltSize); + const unsigned kCoordIdx = 2; - Args.emplace_back(helper.addr); // coord (may be changed later) @2 const unsigned kOffsetIdx = 3; - Args.emplace_back(helper.offset); // offset (may be changed later) @3 const unsigned kMaskIdx = 4; - Args.emplace_back(nullptr); // mask (to be added later) @4 - Args.emplace_back(alignmentVal); // alignment @5 // Keep track of the first load for debug info migration. Value *firstLd = nullptr; + // Create calls to function object. + // Typed buffer loads are limited to one load of up to 4 32-bit values. + // Raw buffer loads might need multiple loads in chunks of 4. for (unsigned i = 0; i < numComponents;) { unsigned chunkSize = (numComponents - i) <= 4 ? numComponents - i : 4; // Assign mask for raw buffer loads. - Args[kMaskIdx] = GetRawBufferMaskForETy(EltTy, chunkSize, OP); - Value *Ld = Builder.CreateCall(F, Args, OP::GetOpCodeName(opcode)); + if (opcode == OP::OpCode::RawBufferLoad) + Args[kMaskIdx] = GetRawBufferMaskForETy(EltTy, chunkSize, OP); - // Extract values from the ResRet structure returned by the load call. - for (unsigned j = 0; j < chunkSize; j++) - elts[i++] = Builder.CreateExtractValue(Ld, j); + Value *Ld = GenerateBufLd(OP, Builder, opcode, Ty->getScalarType(), + chunkSize, Args, elts.begin() + i); + i += chunkSize; // Update status. UpdateStatus(Ld, helper.status, Builder, OP); @@ -4190,7 +4232,7 @@ Value *TranslateBufLoad(ResLoadHelper &helper, HLResource::Kind RK, if (!firstLd) firstLd = Ld; - if (i < numComponents) { + if (opcode == OP::OpCode::RawBufferLoad && i < numComponents) { if (RK == DxilResource::Kind::RawBuffer) // Raw buffers can't use offset param. Add to coord index. Args[kCoordIdx] = @@ -4218,135 +4260,6 @@ Value *TranslateBufLoad(ResLoadHelper &helper, HLResource::Kind RK, return firstLd; } -void TranslateLoad(ResLoadHelper &helper, HLResource::Kind RK, - IRBuilder<> &Builder, hlsl::OP *OP, const DataLayout &DL) { - - Type *Ty = helper.retVal->getType(); - OP::OpCode opcode = helper.opcode; - - Type *i32Ty = Builder.getInt32Ty(); - Type *i64Ty = Builder.getInt64Ty(); - Type *doubleTy = Builder.getDoubleTy(); - Type *EltTy = Ty->getScalarType(); - unsigned numComponents = 1; - if (Ty->isVectorTy()) { - numComponents = Ty->getVectorNumElements(); - } - - bool isTyped = opcode == OP::OpCode::TextureLoad || - RK == DxilResource::Kind::TypedBuffer; - bool is64 = EltTy == i64Ty || EltTy == doubleTy; - if (is64 && isTyped) { - EltTy = i32Ty; - } - bool isBool = EltTy->isIntegerTy(1); - if (isBool) { - // Value will be loaded in its memory representation. - EltTy = i32Ty; - if (Ty->isVectorTy()) - Ty = VectorType::get(EltTy, numComponents); - } - - Function *F = OP->GetOpFunc(opcode, EltTy); - llvm::Constant *opArg = OP->GetU32Const((unsigned)opcode); - - llvm::Value *undefI = llvm::UndefValue::get(i32Ty); - - SmallVector loadArgs; - loadArgs.emplace_back(opArg); // opcode - loadArgs.emplace_back(helper.handle); // resource handle - - if (opcode == OP::OpCode::TextureLoad) { - // set mip level - loadArgs.emplace_back(helper.mipLevel); - } - - if (opcode == OP::OpCode::TextureLoad) { - // texture coord - unsigned coordSize = DxilResource::GetNumCoords(RK); - bool isVectorAddr = helper.addr->getType()->isVectorTy(); - for (unsigned i = 0; i < 3; i++) { - if (i < coordSize) { - loadArgs.emplace_back(isVectorAddr - ? Builder.CreateExtractElement(helper.addr, i) - : helper.addr); - } else - loadArgs.emplace_back(undefI); - } - } else { - if (helper.addr->getType()->isVectorTy()) { - Value *scalarOffset = - Builder.CreateExtractElement(helper.addr, (uint64_t)0); - - // TODO: calculate the real address based on opcode - - loadArgs.emplace_back(scalarOffset); // offset - } else { - // TODO: calculate the real address based on opcode - - loadArgs.emplace_back(helper.addr); // offset - } - } - // offset 0 - if (opcode == OP::OpCode::TextureLoad) { - if (helper.offset && !isa(helper.offset)) { - unsigned offsetSize = DxilResource::GetNumOffsets(RK); - for (unsigned i = 0; i < 3; i++) { - if (i < offsetSize) - loadArgs.emplace_back(Builder.CreateExtractElement(helper.offset, i)); - else - loadArgs.emplace_back(undefI); - } - } else { - loadArgs.emplace_back(undefI); - loadArgs.emplace_back(undefI); - loadArgs.emplace_back(undefI); - } - } - - // Offset 1 - if (RK == DxilResource::Kind::TypedBuffer) { - loadArgs.emplace_back(undefI); - } - - Value *ResRet = Builder.CreateCall(F, loadArgs, OP->GetOpCodeName(opcode)); - dxilutil::MigrateDebugValue(helper.retVal, ResRet); - - Value *retValNew = nullptr; - if (!is64 || !isTyped) { - retValNew = ScalarizeResRet(Ty, ResRet, Builder); - } else { - unsigned size = numComponents; - DXASSERT(size <= 2, "typed buffer only allow 4 dwords"); - EltTy = Ty->getScalarType(); - Value *Elts[2]; - - Make64bitResultForLoad(Ty->getScalarType(), - { - Builder.CreateExtractValue(ResRet, 0), - Builder.CreateExtractValue(ResRet, 1), - Builder.CreateExtractValue(ResRet, 2), - Builder.CreateExtractValue(ResRet, 3), - }, - size, Elts, OP, Builder); - - retValNew = ScalarizeElements(Ty, Elts, Builder); - } - - if (isBool) { - // Convert bool result back to register representation. - retValNew = Builder.CreateICmpNE( - retValNew, Constant::getNullValue(retValNew->getType())); - } - - // replace - helper.retVal->replaceAllUsesWith(retValNew); - // Save new ret val. - helper.retVal = retValNew; - // get status - UpdateStatus(ResRet, helper.status, Builder, OP); -} - Value *TranslateResourceLoad(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, HLOperationLowerHelper &helper, HLObjectOperationLowerHelper *pObjHelper, @@ -4368,11 +4281,9 @@ Value *TranslateResourceLoad(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, "Textures should not be treated as structured buffers."); TranslateStructBufSubscript(cast(ldHelper.retVal), handle, ldHelper.status, hlslOP, RK, DL); - } else if (DXIL::IsRawBuffer(RK) || DXIL::IsStructuredBuffer(RK)) { + } else { Ld = TranslateBufLoad(ldHelper, RK, Builder, hlslOP, DL); dxilutil::MigrateDebugValue(CI, Ld); - } else { - TranslateLoad(ldHelper, RK, Builder, hlslOP, DL); } // CI is replaced by above translation calls.. return nullptr; @@ -7903,6 +7814,60 @@ void TranslateCBOperationsLegacy(Value *handle, Value *ptr, OP *hlslOP, // Structured buffer. namespace { +// Returns load call return value +// and the elements extracted from it in `Elts` +static Value *GenerateBufLd(hlsl::OP *OP, IRBuilder<> &Builder, + OP::OpCode opcode, Type *EltTy, + unsigned NumElements, ArrayRef Args, + std::vector::iterator EltIt) { + Type *i64Ty = Builder.getInt64Ty(); + Type *doubleTy = Builder.getDoubleTy(); + const bool is64 = (EltTy == i64Ty || EltTy == doubleTy); + const bool isBool = EltTy->isIntegerTy(1); + const bool isTyped = + (opcode == OP::OpCode::BufferLoad || opcode == OP::OpCode::TextureLoad); + Function *F = nullptr; + if (isBool || (is64 && isTyped)) + // Value will be loaded in its memory representation. + F = OP->GetOpFunc(opcode, Builder.getInt32Ty()); + else + F = OP->GetOpFunc(opcode, EltTy); + Value *Ld = Builder.CreateCall(F, Args, OP::GetOpCodeName(opcode)); + + // Extract values and convet to register type if needed. + // 64-bit types need to have the two i32 merged into their result + // bools need to use cmp to convert them to i1s. + + if (!is64 || !isTyped) { + for (unsigned i = 0; i < NumElements; i++, EltIt++) + *EltIt = Builder.CreateExtractValue(Ld, i); + } else { + DXASSERT(NumElements <= 2, "typed buffer only allow 4 dwords"); + if (EltTy == doubleTy) { + Function *makeDouble = OP->GetOpFunc(DXIL::OpCode::MakeDouble, doubleTy); + Value *makeDoubleOpArg = + Builder.getInt32((unsigned)DXIL::OpCode::MakeDouble); + for (unsigned i = 0; i < NumElements; i++, EltIt++) { + Value *lo = Builder.CreateExtractValue(Ld, 2 * i); + Value *hi = Builder.CreateExtractValue(Ld, 2 * i + 1); + Value *V = Builder.CreateCall(makeDouble, {makeDoubleOpArg, lo, hi}); + *EltIt = V; + } + } else { + for (unsigned i = 0; i < NumElements; i++, EltIt++) { + Value *lo = Builder.CreateExtractValue(Ld, 2 * i); + Value *hi = Builder.CreateExtractValue(Ld, 2 * i + 1); + lo = Builder.CreateZExt(lo, i64Ty); + hi = Builder.CreateZExt(hi, i64Ty); + hi = Builder.CreateShl(hi, 32); + *EltIt = Builder.CreateOr(lo, hi); + } + } + } + + return Ld; +} + Value *GenerateRawBufLd(Value *handle, Value *bufIdx, Value *offset, Value *status, Type *EltTy, MutableArrayRef resultElts, hlsl::OP *OP, @@ -8424,19 +8389,14 @@ void TranslateStructBufSubscript(CallInst *CI, Value *handle, Value *status, // HLSubscript. namespace { -Value *TranslateTypedBufLoad(CallInst *CI, DXIL::ResourceKind RK, +Value *TranslateTypedBufSubscript(CallInst *CI, DXIL::ResourceKind RK, DXIL::ResourceClass RC, Value *handle, LoadInst *ldInst, IRBuilder<> &Builder, hlsl::OP *hlslOP, const DataLayout &DL) { - // The arguments to the call instruction are used to determine the access, // the return value and type come from the load instruction. ResLoadHelper ldHelper(CI, RK, RC, handle, IntrinsicOp::MOP_Load, ldInst); - // Default sampleIdx for 2DMS textures. - if (RK == DxilResource::Kind::Texture2DMS || - RK == DxilResource::Kind::Texture2DMSArray) - ldHelper.mipLevel = hlslOP->GetU32Const(0); - TranslateLoad(ldHelper, RK, Builder, hlslOP, DL); + TranslateBufLoad(ldHelper, RK, Builder, hlslOP, DL); // delete the ld ldInst->eraseFromParent(); return ldHelper.retVal; @@ -8479,7 +8439,7 @@ Value *UpdateVectorElt(Value *VecVal, Value *EltVal, Value *EltIdx, return VecVal; } -void TranslateDefaultSubscript(CallInst *CI, HLOperationLowerHelper &helper, +void TranslateTypedBufferSubscript(CallInst *CI, HLOperationLowerHelper &helper, HLObjectOperationLowerHelper *pObjHelper, bool &Translated) { Value *ptr = CI->getArgOperand(HLOperandIndex::kSubscriptObjectOpIdx); @@ -8497,7 +8457,7 @@ void TranslateDefaultSubscript(CallInst *CI, HLOperationLowerHelper &helper, Instruction *I = cast(user); IRBuilder<> Builder(I); if (LoadInst *ldInst = dyn_cast(user)) { - TranslateTypedBufLoad(CI, RK, RC, handle, ldInst, Builder, hlslOP, + TranslateTypedBufSubscript(CI, RK, RC, handle, ldInst, Builder, hlslOP, helper.dataLayout); } else if (StoreInst *stInst = dyn_cast(user)) { Value *val = stInst->getValueOperand(); @@ -8520,7 +8480,7 @@ void TranslateDefaultSubscript(CallInst *CI, HLOperationLowerHelper &helper, // Generate Ld. LoadInst *tmpLd = StBuilder.CreateLoad(CI); - Value *ldVal = TranslateTypedBufLoad( + Value *ldVal = TranslateTypedBufSubscript( CI, RK, RC, handle, tmpLd, StBuilder, hlslOP, helper.dataLayout); // Update vector. ldVal = UpdateVectorElt(ldVal, SI->getValueOperand(), EltIdx, @@ -8540,7 +8500,7 @@ void TranslateDefaultSubscript(CallInst *CI, HLOperationLowerHelper &helper, // Generate tmp vector load with vector type & translate it LoadInst *tmpLd = LdBuilder.CreateLoad(CI); - Value *ldVal = TranslateTypedBufLoad( + Value *ldVal = TranslateTypedBufSubscript( CI, RK, RC, handle, tmpLd, LdBuilder, hlslOP, helper.dataLayout); // get the single element @@ -8715,7 +8675,7 @@ void TranslateHLSubscript(CallInst *CI, HLSubscriptOpcode opcode, if (LoadInst *ldInst = dyn_cast(*U)) { Value *Offset = UndefValue::get(Builder.getInt32Ty()); ResLoadHelper ldHelper(ldInst, RK, handle, coord, Offset, mipLevel); - TranslateLoad(ldHelper, RK, Builder, hlslOP, helper.dataLayout); + TranslateBufLoad(ldHelper, RK, Builder, hlslOP, helper.dataLayout); ldInst->eraseFromParent(); } else { StoreInst *stInst = cast(*U); @@ -8753,7 +8713,7 @@ void TranslateHLSubscript(CallInst *CI, HLSubscriptOpcode opcode, TranslateStructBufSubscript(CI, handle, /*status*/ nullptr, hlslOP, RK, helper.dataLayout); else - TranslateDefaultSubscript(CI, helper, pObjHelper, Translated); + TranslateTypedBufferSubscript(CI, helper, pObjHelper, Translated); return; } diff --git a/tools/clang/test/CodeGenDXIL/hlsl/intrinsics/buffer-load-stores.hlsl b/tools/clang/test/CodeGenDXIL/hlsl/intrinsics/buffer-load-stores.hlsl index ea44fef604..8dcf5ead1c 100644 --- a/tools/clang/test/CodeGenDXIL/hlsl/intrinsics/buffer-load-stores.hlsl +++ b/tools/clang/test/CodeGenDXIL/hlsl/intrinsics/buffer-load-stores.hlsl @@ -27,13 +27,20 @@ RWByteAddressBuffer RwByBuf : register(u1); StructuredBuffer< TYPE > RoStBuf : register(t2); RWStructuredBuffer< TYPE > RwStBuf : register(u2); - Buffer< TYPE > RoTyBuf : register(t3); -RWBuffer< TYPE > RwTyBuf : register(u3); +ConsumeStructuredBuffer CnStBuf : register(u3); +AppendStructuredBuffer ApStBuf : register(u4); -ConsumeStructuredBuffer CnStBuf : register(u4); -AppendStructuredBuffer ApStBuf : register(u5); + Buffer< TYPE > RoTyBuf : register(t5); +RWBuffer< TYPE > RwTyBuf : register(u5); -void main(uint ix[2] : IX) { + Texture1D< TYPE > RoTex1d : register(t6); +RWTexture1D< TYPE > RwTex1d : register(u6); + Texture2D< TYPE > RoTex2d : register(t7); +RWTexture2D< TYPE > RwTex2d : register(u7); + Texture3D< TYPE > RoTex3d : register(t8); +RWTexture3D< TYPE > RwTex3d : register(u8); + +void main(uint ix0 : IX0, uint ix1 : IX1, uint2 ix2 : IX2, uint3 ix3 : IX3) { // ByteAddressBuffer Tests // CHECK-DAG: [[HDLROBY:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 1, i32 1, i32 0, i8 0 }, i32 1, i1 false) @@ -42,13 +49,27 @@ void main(uint ix[2] : IX) { // CHECK-DAG: [[HDLROST:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 2, i32 2, i32 0, i8 0 }, i32 2, i1 false) // CHECK-DAG: [[HDLRWST:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 2, i32 2, i32 0, i8 1 }, i32 2, i1 false) - // CHECK-DAG: [[HDLROTY:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 3, i32 3, i32 0, i8 0 }, i32 3, i1 false) - // CHECK-DAG: [[HDLRWTY:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 3, i32 3, i32 0, i8 1 }, i32 3, i1 false) + // CHECK-DAG: [[HDLCON:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 3, i32 3, i32 0, i8 1 }, i32 3, i1 false) + // CHECK-DAG: [[HDLAPP:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 4, i32 4, i32 0, i8 1 }, i32 4, i1 false) + + // CHECK-DAG: [[HDLROTY:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 5, i32 5, i32 0, i8 0 }, i32 5, i1 false) + // CHECK-DAG: [[HDLRWTY:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 5, i32 5, i32 0, i8 1 }, i32 5, i1 false) - // CHECK-DAG: [[HDLCON:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 4, i32 4, i32 0, i8 1 }, i32 4, i1 false) - // CHECK-DAG: [[HDLAPP:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 5, i32 5, i32 0, i8 1 }, i32 5, i1 false) + // CHECK-DAG: [[HDLROTX1:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 6, i32 6, i32 0, i8 0 }, i32 6, i1 false) + // CHECK-DAG: [[HDLRWTX1:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 6, i32 6, i32 0, i8 1 }, i32 6, i1 false) + // CHECK-DAG: [[HDLROTX2:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 7, i32 7, i32 0, i8 0 }, i32 7, i1 false) + // CHECK-DAG: [[HDLRWTX2:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 7, i32 7, i32 0, i8 1 }, i32 7, i1 false) + // CHECK-DAG: [[HDLROTX3:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 8, i32 8, i32 0, i8 0 }, i32 8, i1 false) + // CHECK-DAG: [[HDLRWTX3:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 8, i32 8, i32 0, i8 1 }, i32 8, i1 false) - // CHECK: [[IX0:%.*]] = call i32 @dx.op.loadInput.i32(i32 4, + + // CHECK-DAG: [[IX0:%.*]] = call i32 @dx.op.loadInput.i32(i32 4, i32 0, i32 0, i8 0 + // CHECK-DAG: [[IX1:%.*]] = call i32 @dx.op.loadInput.i32(i32 4, i32 1, i32 0, i8 0 + // CHECK-DAG: [[IX20:%.*]] = call i32 @dx.op.loadInput.i32(i32 4, i32 2, i32 0, i8 0 + // CHECK-DAG: [[IX21:%.*]] = call i32 @dx.op.loadInput.i32(i32 4, i32 2, i32 0, i8 1 + // CHECK-DAG: [[IX30:%.*]] = call i32 @dx.op.loadInput.i32(i32 4, i32 3, i32 0, i8 0 + // CHECK-DAG: [[IX31:%.*]] = call i32 @dx.op.loadInput.i32(i32 4, i32 3, i32 0, i8 1 + // CHECK-DAG: [[IX32:%.*]] = call i32 @dx.op.loadInput.i32(i32 4, i32 3, i32 0, i8 2 // CHECK: [[ANHDLRWBY:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLRWBY]] // CHECK: call %dx.types.ResRet.[[TY]] @dx.op.rawBufferLoad.[[TY]](i32 139, %dx.types.Handle [[ANHDLRWBY]], i32 [[IX0]] @@ -56,7 +77,7 @@ void main(uint ix[2] : IX) { // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 - TYPE babElt1 = RwByBuf.Load< TYPE >(ix[0]); + TYPE babElt1 = RwByBuf.Load< TYPE >(ix0); // CHECK: [[ANHDLROBY:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLROBY]] // CHECK: call %dx.types.ResRet.[[TY]] @dx.op.rawBufferLoad.[[TY]](i32 139, %dx.types.Handle [[ANHDLROBY]], i32 [[IX0]] @@ -64,14 +85,14 @@ void main(uint ix[2] : IX) { // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 - TYPE babElt2 = RoByBuf.Load< TYPE >(ix[0]); + TYPE babElt2 = RoByBuf.Load< TYPE >(ix0); // I1: zext i1 %{{.*}} to i32 // I1: zext i1 %{{.*}} to i32 // I1: zext i1 %{{.*}} to i32 // I1: zext i1 %{{.*}} to i32 // CHECK: all void @dx.op.rawBufferStore.[[TY]](i32 140, %dx.types.Handle [[ANHDLRWBY]], i32 [[IX0]] - RwByBuf.Store< TYPE >(ix[0], babElt1 + babElt2); + RwByBuf.Store< TYPE >(ix0, babElt1 + babElt2); // StructuredBuffer Tests // CHECK: [[ANHDLRWST:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLRWST]] @@ -80,14 +101,13 @@ void main(uint ix[2] : IX) { // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 - TYPE stbElt1 = RwStBuf.Load(ix[0]); - // CHECK: [[IX1:%.*]] = call i32 @dx.op.loadInput.i32(i32 4, + TYPE stbElt1 = RwStBuf.Load(ix0); // CHECK: call %dx.types.ResRet.[[TY]] @dx.op.rawBufferLoad.[[TY]](i32 139, %dx.types.Handle [[ANHDLRWST]], i32 [[IX1]] // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 - TYPE stbElt2 = RwStBuf[ix[1]]; + TYPE stbElt2 = RwStBuf[ix1]; // CHECK: [[ANHDLROST:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLROST]] // CHECK: call %dx.types.ResRet.[[TY]] @dx.op.rawBufferLoad.[[TY]](i32 139, %dx.types.Handle [[ANHDLROST]], i32 [[IX0]] @@ -95,20 +115,20 @@ void main(uint ix[2] : IX) { // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 - TYPE stbElt3 = RoStBuf.Load(ix[0]); + TYPE stbElt3 = RoStBuf.Load(ix0); // CHECK: call %dx.types.ResRet.[[TY]] @dx.op.rawBufferLoad.[[TY]](i32 139, %dx.types.Handle [[ANHDLROST]], i32 [[IX1]] // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 - TYPE stbElt4 = RoStBuf[ix[1]]; + TYPE stbElt4 = RoStBuf[ix1]; // I1: zext i1 %{{.*}} to i32 // I1: zext i1 %{{.*}} to i32 // I1: zext i1 %{{.*}} to i32 // I1: zext i1 %{{.*}} to i32 // CHECK: all void @dx.op.rawBufferStore.[[TY]](i32 140, %dx.types.Handle [[ANHDLRWST]], i32 [[IX0]] - RwStBuf[ix[0]] = stbElt1 + stbElt2 + stbElt3 + stbElt4; + RwStBuf[ix0] = stbElt1 + stbElt2 + stbElt3 + stbElt4; // {Append/Consume}StructuredBuffer Tests // CHECK: [[ANHDLCON:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLCON]] @@ -146,7 +166,7 @@ void main(uint ix[2] : IX) { // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 - TYPE typElt1 = RwTyBuf.Load(ix[0]); + TYPE typElt1 = RwTyBuf.Load(ix0); // CHECK: call %dx.types.ResRet.[[TY32]] @dx.op.bufferLoad.[[TY32]](i32 68, %dx.types.Handle [[ANHDLRWTY]], i32 [[IX1]] // F64: call double @dx.op.makeDouble.f64(i32 101 // F64: call double @dx.op.makeDouble.f64(i32 101 @@ -162,7 +182,7 @@ void main(uint ix[2] : IX) { // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 - TYPE typElt2 = RwTyBuf[ix[1]]; + TYPE typElt2 = RwTyBuf[ix1]; // CHECK: [[ANHDLROTY:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLROTY]] // CHECK: call %dx.types.ResRet.[[TY32]] @dx.op.bufferLoad.[[TY32]](i32 68, %dx.types.Handle [[ANHDLROTY]], i32 [[IX0]] // F64: call double @dx.op.makeDouble.f64(i32 101 @@ -179,7 +199,7 @@ void main(uint ix[2] : IX) { // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 - TYPE typElt3 = RoTyBuf.Load(ix[0]); + TYPE typElt3 = RoTyBuf.Load(ix0); // CHECK: call %dx.types.ResRet.[[TY32]] @dx.op.bufferLoad.[[TY32]](i32 68, %dx.types.Handle [[ANHDLROTY]], i32 [[IX1]] // F64: call double @dx.op.makeDouble.f64(i32 101 // F64: call double @dx.op.makeDouble.f64(i32 101 @@ -195,7 +215,7 @@ void main(uint ix[2] : IX) { // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 // I1: icmp ne i32 %{{.*}}, 0 - TYPE typElt4 = RoTyBuf[ix[1]]; + TYPE typElt4 = RoTyBuf[ix1]; // F64: call %dx.types.splitdouble @dx.op.splitDouble.f64(i32 102 // F64: call %dx.types.splitdouble @dx.op.splitDouble.f64(i32 102 @@ -210,5 +230,126 @@ void main(uint ix[2] : IX) { // I1: zext i1 %{{.*}} to i32 // I1: zext i1 %{{.*}} to i32 // CHECK: all void @dx.op.bufferStore.[[TY32]](i32 69, %dx.types.Handle [[ANHDLRWTY]], i32 [[IX0]] - RwTyBuf[ix[0]] = typElt1 + typElt2 + typElt3 + typElt4; + RwTyBuf[ix0] = typElt1 + typElt2 + typElt3 + typElt4; + + // Texture Tests + // CHECK: [[ANHDLROTX1:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLROTX1]] + // CHECK: call %dx.types.ResRet.[[TY32]] @dx.op.textureLoad.[[TY32]](i32 66, %dx.types.Handle [[ANHDLROTX1]], i32 0, i32 [[IX0]], i32 undef, i32 undef + // F64: call double @dx.op.makeDouble.f64(i32 101 + // F64: call double @dx.op.makeDouble.f64(i32 101 + // I64: zext i32 %{{.*}} to i64 + // I64: zext i32 %{{.*}} to i64 + // I64: shl nuw i64 + // I64: or i64 + // I64: zext i32 %{{.*}} to i64 + // I64: zext i32 %{{.*}} to i64 + // I64: shl nuw i64 + // I64: or i64 + // I1: icmp ne i32 %{{.*}}, 0 + // I1: icmp ne i32 %{{.*}}, 0 + // I1: icmp ne i32 %{{.*}}, 0 + // I1: icmp ne i32 %{{.*}}, 0 + TYPE texElt1 = RoTex1d[ix0]; + // CHECK: [[ANHDLRWTX1:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLRWTX1]] + // CHECK: call %dx.types.ResRet.[[TY32]] @dx.op.textureLoad.[[TY32]](i32 66, %dx.types.Handle [[ANHDLRWTX1]], i32 undef, i32 [[IX0]], i32 undef, i32 undef + // F64: call double @dx.op.makeDouble.f64(i32 101 + // F64: call double @dx.op.makeDouble.f64(i32 101 + // I64: zext i32 %{{.*}} to i64 + // I64: zext i32 %{{.*}} to i64 + // I64: shl nuw i64 + // I64: or i64 + // I64: zext i32 %{{.*}} to i64 + // I64: zext i32 %{{.*}} to i64 + // I64: shl nuw i64 + // I64: or i64 + // I1: icmp ne i32 %{{.*}}, 0 + // I1: icmp ne i32 %{{.*}}, 0 + // I1: icmp ne i32 %{{.*}}, 0 + // I1: icmp ne i32 %{{.*}}, 0 + TYPE texElt2 = RwTex1d[ix0]; + + // CHECK: [[ANHDLROTX2:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLROTX2]] + // CHECK: call %dx.types.ResRet.[[TY32]] @dx.op.textureLoad.[[TY32]](i32 66, %dx.types.Handle [[ANHDLROTX2]], i32 0, i32 [[IX20]], i32 [[IX21]], i32 undef + // F64: call double @dx.op.makeDouble.f64(i32 101 + // F64: call double @dx.op.makeDouble.f64(i32 101 + // I64: zext i32 %{{.*}} to i64 + // I64: zext i32 %{{.*}} to i64 + // I64: shl nuw i64 + // I64: or i64 + // I64: zext i32 %{{.*}} to i64 + // I64: zext i32 %{{.*}} to i64 + // I64: shl nuw i64 + // I64: or i64 + // I1: icmp ne i32 %{{.*}}, 0 + // I1: icmp ne i32 %{{.*}}, 0 + // I1: icmp ne i32 %{{.*}}, 0 + // I1: icmp ne i32 %{{.*}}, 0 + TYPE texElt3 = RoTex2d[ix2]; + // CHECK: [[ANHDLRWTX2:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLRWTX2]] + // CHECK: call %dx.types.ResRet.[[TY32]] @dx.op.textureLoad.[[TY32]](i32 66, %dx.types.Handle [[ANHDLRWTX2]], i32 undef, i32 [[IX20]], i32 [[IX21]], i32 undef + // F64: call double @dx.op.makeDouble.f64(i32 101 + // F64: call double @dx.op.makeDouble.f64(i32 101 + // I64: zext i32 %{{.*}} to i64 + // I64: zext i32 %{{.*}} to i64 + // I64: shl nuw i64 + // I64: or i64 + // I64: zext i32 %{{.*}} to i64 + // I64: zext i32 %{{.*}} to i64 + // I64: shl nuw i64 + // I64: or i64 + // I1: icmp ne i32 %{{.*}}, 0 + // I1: icmp ne i32 %{{.*}}, 0 + // I1: icmp ne i32 %{{.*}}, 0 + // I1: icmp ne i32 %{{.*}}, 0 + TYPE texElt4 = RwTex2d[ix2]; + + // CHECK: [[ANHDLROTX3:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLROTX3]] + // CHECK: call %dx.types.ResRet.[[TY32]] @dx.op.textureLoad.[[TY32]](i32 66, %dx.types.Handle [[ANHDLROTX3]], i32 0, i32 [[IX30]], i32 [[IX31]], i32 [[IX32]] + // F64: call double @dx.op.makeDouble.f64(i32 101 + // F64: call double @dx.op.makeDouble.f64(i32 101 + // I64: zext i32 %{{.*}} to i64 + // I64: zext i32 %{{.*}} to i64 + // I64: shl nuw i64 + // I64: or i64 + // I64: zext i32 %{{.*}} to i64 + // I64: zext i32 %{{.*}} to i64 + // I64: shl nuw i64 + // I64: or i64 + // I1: icmp ne i32 %{{.*}}, 0 + // I1: icmp ne i32 %{{.*}}, 0 + // I1: icmp ne i32 %{{.*}}, 0 + // I1: icmp ne i32 %{{.*}}, 0 + TYPE texElt5 = RoTex3d[ix3]; + // CHECK: [[ANHDLRWTX3:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLRWTX3]] + // CHECK: call %dx.types.ResRet.[[TY32]] @dx.op.textureLoad.[[TY32]](i32 66, %dx.types.Handle [[ANHDLRWTX3]], i32 undef, i32 [[IX30]], i32 [[IX31]], i32 [[IX32]] + // F64: call double @dx.op.makeDouble.f64(i32 101 + // F64: call double @dx.op.makeDouble.f64(i32 101 + // I64: zext i32 %{{.*}} to i64 + // I64: zext i32 %{{.*}} to i64 + // I64: shl nuw i64 + // I64: or i64 + // I64: zext i32 %{{.*}} to i64 + // I64: zext i32 %{{.*}} to i64 + // I64: shl nuw i64 + // I64: or i64 + // I1: icmp ne i32 %{{.*}}, 0 + // I1: icmp ne i32 %{{.*}}, 0 + // I1: icmp ne i32 %{{.*}}, 0 + // I1: icmp ne i32 %{{.*}}, 0 + TYPE texElt6 = RwTex3d[ix3]; + + // F64: call %dx.types.splitdouble @dx.op.splitDouble.f64(i32 102 + // F64: call %dx.types.splitdouble @dx.op.splitDouble.f64(i32 102 + // I64: trunc i64 %{{.*}} to i32 + // lshr i64 %{{.*}}, 32 + // I64: trunc i64 %{{.*}} to i32 + // I64: trunc i64 %{{.*}} to i32 + // lshr i64 %{{.*}}, 32 + // I64: trunc i64 %{{.*}} to i32 + // I1: zext i1 %{{.*}} to i32 + // I1: zext i1 %{{.*}} to i32 + // I1: zext i1 %{{.*}} to i32 + // I1: zext i1 %{{.*}} to i32 + // CHECK: call void @dx.op.textureStore.[[TY32]](i32 67, %dx.types.Handle [[ANHDLRWTX3]], i32 [[IX30]], i32 [[IX31]], i32 [[IX32]] + RwTex3d[ix3] = texElt1 + texElt2 + texElt3 + texElt4 + texElt5 + texElt6; } From 69b7cf735ad8e6c3d27bacac0a285e2dd302f245 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Mon, 10 Mar 2025 00:46:24 -0600 Subject: [PATCH 24/45] refactor GenerateRawBufLd and TranslateBufLd interface Clarify some naming and reduce some redundancy between GenerateRawBufLd and TranslateBufLoad. Part of this involved passing the correct vector of i32 type for loading boolean vectors in sm69 raw buffer loads. --- lib/HLSL/HLOperationLower.cpp | 100 ++++++++++++++++------------------ 1 file changed, 47 insertions(+), 53 deletions(-) diff --git a/lib/HLSL/HLOperationLower.cpp b/lib/HLSL/HLOperationLower.cpp index 2b397382b9..cf0db42ac2 100644 --- a/lib/HLSL/HLOperationLower.cpp +++ b/lib/HLSL/HLOperationLower.cpp @@ -4110,7 +4110,7 @@ Value *GenerateRawBufLd(Value *handle, Value *bufIdx, Value *offset, Constant *alignment); static Value *GenerateBufLd(hlsl::OP *OP, IRBuilder<> &Builder, - OP::OpCode opcode, Type *EltTy, + OP::OpCode opcode, Type *RegTy, Type *MemTy, unsigned NumElements, ArrayRef Args, std::vector::iterator EltIt); @@ -4118,12 +4118,12 @@ static Value *GenerateBufLd(hlsl::OP *OP, IRBuilder<> &Builder, static SmallVector GetBufLoadArgs(ResLoadHelper helper, HLResource::Kind RK, IRBuilder<> Builder, Type *EltTy, - unsigned EltSize) { + unsigned LdSize) { OP::OpCode opcode = helper.opcode; llvm::Constant *opArg = Builder.getInt32((uint32_t)opcode); unsigned alignment = RK == DxilResource::Kind::RawBuffer ? 4U : 8U; - alignment = std::min(alignment, EltSize); + alignment = std::min(alignment, LdSize); Constant *alignmentVal = Builder.getInt32(alignment); // Assemble args is specific to the type bab/struct/typed @@ -4182,29 +4182,26 @@ static SmallVector GetBufLoadArgs(ResLoadHelper helper, Value *TranslateBufLoad(ResLoadHelper &helper, HLResource::Kind RK, IRBuilder<> &Builder, hlsl::OP *OP, const DataLayout &DL) { + OP::OpCode opcode = helper.opcode; Type *Ty = helper.retVal->getType(); - Type *EltTy = Ty->getScalarType(); unsigned numComponents = 1; - if (Ty->isVectorTy()) { + if (Ty->isVectorTy()) numComponents = Ty->getVectorNumElements(); - } - Type *i32Ty = Builder.getInt32Ty(); - Type *i64Ty = Builder.getInt64Ty(); - Type *doubleTy = Builder.getDoubleTy(); const bool isTyped = DXIL::IsTyped(RK); - const bool is64 = (EltTy == i64Ty || EltTy == doubleTy); + Type *EltTy = Ty->getScalarType(); + const bool is64 = (EltTy->isIntegerTy(64) || EltTy->isDoubleTy()); const bool isBool = EltTy->isIntegerTy(1); + Type *MemTy = EltTy; if (isBool || (is64 && isTyped)) // Value will be loaded in its memory representation. - EltTy = i32Ty; - unsigned EltSize = DL.getTypeAllocSize(EltTy); + MemTy = Builder.getInt32Ty(); + unsigned LdSize = DL.getTypeAllocSize(MemTy); std::vector elts(numComponents); - OP::OpCode opcode = helper.opcode; SmallVector Args = - GetBufLoadArgs(helper, RK, Builder, EltTy, EltSize); + GetBufLoadArgs(helper, RK, Builder, MemTy, LdSize); const unsigned kCoordIdx = 2; const unsigned kOffsetIdx = 3; @@ -4220,9 +4217,9 @@ Value *TranslateBufLoad(ResLoadHelper &helper, HLResource::Kind RK, // Assign mask for raw buffer loads. if (opcode == OP::OpCode::RawBufferLoad) - Args[kMaskIdx] = GetRawBufferMaskForETy(EltTy, chunkSize, OP); + Args[kMaskIdx] = GetRawBufferMaskForETy(MemTy, chunkSize, OP); - Value *Ld = GenerateBufLd(OP, Builder, opcode, Ty->getScalarType(), + Value *Ld = GenerateBufLd(OP, Builder, opcode, Ty->getScalarType(), MemTy, chunkSize, Args, elts.begin() + i); i += chunkSize; @@ -4236,11 +4233,11 @@ Value *TranslateBufLoad(ResLoadHelper &helper, HLResource::Kind RK, if (RK == DxilResource::Kind::RawBuffer) // Raw buffers can't use offset param. Add to coord index. Args[kCoordIdx] = - Builder.CreateAdd(Args[kCoordIdx], OP->GetU32Const(4 * EltSize)); + Builder.CreateAdd(Args[kCoordIdx], OP->GetU32Const(4 * LdSize)); else // Structured buffers increment the offset parameter. Args[kOffsetIdx] = - Builder.CreateAdd(Args[kOffsetIdx], OP->GetU32Const(4 * EltSize)); + Builder.CreateAdd(Args[kOffsetIdx], OP->GetU32Const(4 * LdSize)); } } @@ -7817,54 +7814,51 @@ namespace { // Returns load call return value // and the elements extracted from it in `Elts` static Value *GenerateBufLd(hlsl::OP *OP, IRBuilder<> &Builder, - OP::OpCode opcode, Type *EltTy, + OP::OpCode opcode, Type *RegTy, Type *MemTy, unsigned NumElements, ArrayRef Args, std::vector::iterator EltIt) { - Type *i64Ty = Builder.getInt64Ty(); - Type *doubleTy = Builder.getDoubleTy(); - const bool is64 = (EltTy == i64Ty || EltTy == doubleTy); - const bool isBool = EltTy->isIntegerTy(1); const bool isTyped = (opcode == OP::OpCode::BufferLoad || opcode == OP::OpCode::TextureLoad); - Function *F = nullptr; - if (isBool || (is64 && isTyped)) - // Value will be loaded in its memory representation. - F = OP->GetOpFunc(opcode, Builder.getInt32Ty()); - else - F = OP->GetOpFunc(opcode, EltTy); + // Value will be loaded in its memory representation. + Function *F = OP->GetOpFunc(opcode, MemTy); Value *Ld = Builder.CreateCall(F, Args, OP::GetOpCodeName(opcode)); // Extract values and convet to register type if needed. // 64-bit types need to have the two i32 merged into their result // bools need to use cmp to convert them to i1s. - if (!is64 || !isTyped) { - for (unsigned i = 0; i < NumElements; i++, EltIt++) - *EltIt = Builder.CreateExtractValue(Ld, i); - } else { - DXASSERT(NumElements <= 2, "typed buffer only allow 4 dwords"); - if (EltTy == doubleTy) { - Function *makeDouble = OP->GetOpFunc(DXIL::OpCode::MakeDouble, doubleTy); - Value *makeDoubleOpArg = - Builder.getInt32((unsigned)DXIL::OpCode::MakeDouble); - for (unsigned i = 0; i < NumElements; i++, EltIt++) { - Value *lo = Builder.CreateExtractValue(Ld, 2 * i); - Value *hi = Builder.CreateExtractValue(Ld, 2 * i + 1); - Value *V = Builder.CreateCall(makeDouble, {makeDoubleOpArg, lo, hi}); - *EltIt = V; - } - } else { - for (unsigned i = 0; i < NumElements; i++, EltIt++) { - Value *lo = Builder.CreateExtractValue(Ld, 2 * i); - Value *hi = Builder.CreateExtractValue(Ld, 2 * i + 1); - lo = Builder.CreateZExt(lo, i64Ty); - hi = Builder.CreateZExt(hi, i64Ty); - hi = Builder.CreateShl(hi, 32); - *EltIt = Builder.CreateOr(lo, hi); - } + if (isTyped && RegTy->isDoubleTy()) { + DXASSERT(NumElements <= 2, "typed buffers only allow 4 dwords"); + Type *doubleTy = Builder.getDoubleTy(); + Function *makeDouble = OP->GetOpFunc(DXIL::OpCode::MakeDouble, doubleTy); + Value *makeDoubleOpArg = + Builder.getInt32((unsigned)DXIL::OpCode::MakeDouble); + for (unsigned i = 0; i < NumElements; i++, EltIt++) { + Value *lo = Builder.CreateExtractValue(Ld, 2 * i); + Value *hi = Builder.CreateExtractValue(Ld, 2 * i + 1); + Value *V = Builder.CreateCall(makeDouble, {makeDoubleOpArg, lo, hi}); + *EltIt = V; + } + return Ld; + } + + if (isTyped && RegTy->isIntegerTy(64)) { + DXASSERT(NumElements <= 2, "typed buffers only allow 4 dwords"); + Type *i64Ty = Builder.getInt64Ty(); + for (unsigned i = 0; i < NumElements; i++, EltIt++) { + Value *lo = Builder.CreateExtractValue(Ld, 2 * i); + Value *hi = Builder.CreateExtractValue(Ld, 2 * i + 1); + lo = Builder.CreateZExt(lo, i64Ty); + hi = Builder.CreateZExt(hi, i64Ty); + hi = Builder.CreateShl(hi, 32); + *EltIt = Builder.CreateOr(lo, hi); } + return Ld; } + for (unsigned i = 0; i < NumElements; i++, EltIt++) + *EltIt = Builder.CreateExtractValue(Ld, i); + return Ld; } From a90b420cee0a9febb1022b0ba8f488099c926d33 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Thu, 13 Feb 2025 09:54:28 -0700 Subject: [PATCH 25/45] Enable native vector DXIL intrinsic overload for vector load/store Add a new native vector overload type to DXIL intrinsics and the corresponding generation. Add new raw buffer vector load/store intrinsics that use that overload type. --- include/dxc/DXIL/DxilConstants.h | 11 +- include/dxc/DXIL/DxilInstructions.h | 93 +++ include/dxc/DXIL/DxilOperations.h | 6 +- lib/DXIL/DxilOperations.cpp | 854 ++++++++++++++------------ lib/DxilValidation/DxilValidation.cpp | 17 +- utils/hct/hctdb.py | 77 +++ utils/hct/hctdb_instrhelp.py | 10 +- 7 files changed, 659 insertions(+), 409 deletions(-) diff --git a/include/dxc/DXIL/DxilConstants.h b/include/dxc/DXIL/DxilConstants.h index b3c510a038..cba491ec2f 100644 --- a/include/dxc/DXIL/DxilConstants.h +++ b/include/dxc/DXIL/DxilConstants.h @@ -482,6 +482,9 @@ inline bool IsFeedbackTexture(DXIL::ResourceKind ResourceKind) { // Enumeration for operations specified by DXIL enum class OpCode : unsigned { // + RawBufferVectorLoad = 303, // reads from a raw buffer and structured buffer + RawBufferVectorStore = + 304, // writes to a RWByteAddressBuffer or RWStructuredBuffer Reserved0 = 226, // Reserved Reserved1 = 227, // Reserved Reserved10 = 236, // Reserved @@ -1036,8 +1039,9 @@ enum class OpCode : unsigned { NumOpCodes_Dxil_1_6 = 222, NumOpCodes_Dxil_1_7 = 226, NumOpCodes_Dxil_1_8 = 258, + NumOpCodes_Dxil_1_9 = 305, - NumOpCodes = 303 // exclusive last value of enumeration + NumOpCodes = 305 // exclusive last value of enumeration }; // OPCODE-ENUM:END @@ -1049,6 +1053,8 @@ enum class OpCode : unsigned { // Groups for DXIL operations with equivalent function templates enum class OpCodeClass : unsigned { // + RawBufferVectorLoad, + RawBufferVectorStore, Reserved, // Amplification shader instructions @@ -1344,8 +1350,9 @@ enum class OpCodeClass : unsigned { NumOpClasses_Dxil_1_6 = 149, NumOpClasses_Dxil_1_7 = 153, NumOpClasses_Dxil_1_8 = 174, + NumOpClasses_Dxil_1_9 = 177, - NumOpClasses = 175 // exclusive last value of enumeration + NumOpClasses = 177 // exclusive last value of enumeration }; // OPCODECLASS-ENUM:END diff --git a/include/dxc/DXIL/DxilInstructions.h b/include/dxc/DXIL/DxilInstructions.h index 1523500d0c..c685f64b49 100644 --- a/include/dxc/DXIL/DxilInstructions.h +++ b/include/dxc/DXIL/DxilInstructions.h @@ -8849,5 +8849,98 @@ struct DxilInst_AllocateRayQuery2 { llvm::APInt(32, (uint64_t)val))); } }; + +/// This instruction reads from a raw buffer and structured buffer +struct DxilInst_RawBufferVectorLoad { + llvm::Instruction *Instr; + // Construction and identification + DxilInst_RawBufferVectorLoad(llvm::Instruction *pInstr) : Instr(pInstr) {} + operator bool() const { + return hlsl::OP::IsDxilOpFuncCallInst( + Instr, hlsl::OP::OpCode::RawBufferVectorLoad); + } + // Validation support + bool isAllowed() const { return true; } + bool isArgumentListValid() const { + if (5 != llvm::dyn_cast(Instr)->getNumArgOperands()) + return false; + return true; + } + // Metadata + bool requiresUniformInputs() const { return false; } + // Operand indexes + enum OperandIdx { + arg_srv = 1, + arg_index = 2, + arg_elementOffset = 3, + arg_alignment = 4, + }; + // Accessors + llvm::Value *get_srv() const { return Instr->getOperand(1); } + void set_srv(llvm::Value *val) { Instr->setOperand(1, val); } + llvm::Value *get_index() const { return Instr->getOperand(2); } + void set_index(llvm::Value *val) { Instr->setOperand(2, val); } + llvm::Value *get_elementOffset() const { return Instr->getOperand(3); } + void set_elementOffset(llvm::Value *val) { Instr->setOperand(3, val); } + llvm::Value *get_alignment() const { return Instr->getOperand(4); } + void set_alignment(llvm::Value *val) { Instr->setOperand(4, val); } + int32_t get_alignment_val() const { + return (int32_t)(llvm::dyn_cast(Instr->getOperand(4)) + ->getZExtValue()); + } + void set_alignment_val(int32_t val) { + Instr->setOperand(4, llvm::Constant::getIntegerValue( + llvm::IntegerType::get(Instr->getContext(), 32), + llvm::APInt(32, (uint64_t)val))); + } +}; + +/// This instruction writes to a RWByteAddressBuffer or RWStructuredBuffer +struct DxilInst_RawBufferVectorStore { + llvm::Instruction *Instr; + // Construction and identification + DxilInst_RawBufferVectorStore(llvm::Instruction *pInstr) : Instr(pInstr) {} + operator bool() const { + return hlsl::OP::IsDxilOpFuncCallInst( + Instr, hlsl::OP::OpCode::RawBufferVectorStore); + } + // Validation support + bool isAllowed() const { return true; } + bool isArgumentListValid() const { + if (6 != llvm::dyn_cast(Instr)->getNumArgOperands()) + return false; + return true; + } + // Metadata + bool requiresUniformInputs() const { return false; } + // Operand indexes + enum OperandIdx { + arg_uav = 1, + arg_index = 2, + arg_elementOffset = 3, + arg_value0 = 4, + arg_alignment = 5, + }; + // Accessors + llvm::Value *get_uav() const { return Instr->getOperand(1); } + void set_uav(llvm::Value *val) { Instr->setOperand(1, val); } + llvm::Value *get_index() const { return Instr->getOperand(2); } + void set_index(llvm::Value *val) { Instr->setOperand(2, val); } + llvm::Value *get_elementOffset() const { return Instr->getOperand(3); } + void set_elementOffset(llvm::Value *val) { Instr->setOperand(3, val); } + llvm::Value *get_value0() const { return Instr->getOperand(4); } + void set_value0(llvm::Value *val) { Instr->setOperand(4, val); } + llvm::Value *get_alignment() const { return Instr->getOperand(5); } + void set_alignment(llvm::Value *val) { Instr->setOperand(5, val); } + int32_t get_alignment_val() const { + return (int32_t)(llvm::dyn_cast(Instr->getOperand(5)) + ->getZExtValue()); + } + void set_alignment_val(int32_t val) { + Instr->setOperand(5, llvm::Constant::getIntegerValue( + llvm::IntegerType::get(Instr->getContext(), 32), + llvm::APInt(32, (uint64_t)val))); + } +}; // INSTR-HELPER:END } // namespace hlsl diff --git a/include/dxc/DXIL/DxilOperations.h b/include/dxc/DXIL/DxilOperations.h index 3514701327..a9621d0e51 100644 --- a/include/dxc/DXIL/DxilOperations.h +++ b/include/dxc/DXIL/DxilOperations.h @@ -63,6 +63,7 @@ class OP { bool IsDxilOpUsed(OpCode opcode) const; void RemoveFunction(llvm::Function *F); llvm::LLVMContext &GetCtx() { return m_Ctx; } + llvm::Module *GetModule() { return m_pModule; } llvm::Type *GetHandleType() const; llvm::Type *GetNodeHandleType() const; llvm::Type *GetNodeRecordHandleType() const; @@ -164,8 +165,9 @@ class OP { static const unsigned kUserDefineTypeSlot = 9; static const unsigned kObjectTypeSlot = 10; + static const unsigned kVectorTypeSlot = 11; static const unsigned kNumTypeOverloads = - 11; // void, h,f,d, i1, i8,i16,i32,i64, udt, obj + 12; // void, h,f,d, i1, i8,i16,i32,i64, udt, obj llvm::Type *m_pResRetType[kNumTypeOverloads]; llvm::Type *m_pCBufferRetType[kNumTypeOverloads]; @@ -185,7 +187,7 @@ class OP { OpCodeClass opCodeClass; const char *pOpCodeClassName; bool bAllowOverload[kNumTypeOverloads]; // void, h,f,d, i1, i8,i16,i32,i64, - // udt + // udt, obj, vec llvm::Attribute::AttrKind FuncAttr; }; static const OpCodeProperty m_OpCodeProps[(unsigned)OpCode::NumOpCodes]; diff --git a/lib/DXIL/DxilOperations.cpp b/lib/DXIL/DxilOperations.cpp index b3e552da18..5e92d58999 100644 --- a/lib/DXIL/DxilOperations.cpp +++ b/lib/DXIL/DxilOperations.cpp @@ -43,16 +43,16 @@ import hctdb_instrhelp const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { // OpCode OpCode name, OpCodeClass // OpCodeClass name, void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj, function attribute + // i16, i32, i64, udt, obj, vec, function attribute // Temporary, indexable, input, output registers void, h, f, d, - // i1, i8, i16, i32, i64, udt, obj , function attribute + // i1, i8, i16, i32, i64, udt, obj, vec, function attribute { OC::TempRegLoad, "TempRegLoad", OCC::TempRegLoad, "tempRegLoad", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -61,7 +61,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::TempRegStore, "tempRegStore", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::None, }, { @@ -70,7 +70,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::MinPrecXRegLoad, "minPrecXRegLoad", {false, true, false, false, false, false, true, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -79,7 +79,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::MinPrecXRegStore, "minPrecXRegStore", {false, true, false, false, false, false, true, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -88,7 +88,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::LoadInput, "loadInput", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -97,19 +97,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::StoreOutput, "storeOutput", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::None, }, // Unary float void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::FAbs, "FAbs", OCC::Unary, "unary", {false, true, true, true, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -118,7 +118,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, true, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -127,7 +127,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::IsSpecialFloat, "isSpecialFloat", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -136,7 +136,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::IsSpecialFloat, "isSpecialFloat", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -145,7 +145,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::IsSpecialFloat, "isSpecialFloat", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -154,7 +154,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::IsSpecialFloat, "isSpecialFloat", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -163,7 +163,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -172,7 +172,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -181,7 +181,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -190,7 +190,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -199,7 +199,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -208,7 +208,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -217,7 +217,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -226,7 +226,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -235,7 +235,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -244,7 +244,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -253,7 +253,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -262,7 +262,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -271,7 +271,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -280,19 +280,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Unary float - rounding void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj , function attribute + // i32, i64, udt, obj, vec, function attribute { OC::Round_ne, "Round_ne", OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -301,7 +301,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -310,7 +310,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -319,19 +319,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Unary int void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::Bfrev, "Bfrev", OCC::Unary, "unary", {false, false, false, false, false, false, true, true, true, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -340,7 +340,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::UnaryBits, "unaryBits", {false, false, false, false, false, false, true, true, true, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -349,43 +349,43 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::UnaryBits, "unaryBits", {false, false, false, false, false, false, true, true, true, false, - false}, + false, false}, Attribute::ReadNone, }, // Unary uint void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::FirstbitHi, "FirstbitHi", OCC::UnaryBits, "unaryBits", {false, false, false, false, false, false, true, true, true, false, - false}, + false, false}, Attribute::ReadNone, }, // Unary int void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::FirstbitSHi, "FirstbitSHi", OCC::UnaryBits, "unaryBits", {false, false, false, false, false, false, true, true, true, false, - false}, + false, false}, Attribute::ReadNone, }, // Binary float void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::FMax, "FMax", OCC::Binary, "binary", {false, true, true, true, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -394,19 +394,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Binary, "binary", {false, true, true, true, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Binary int void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::IMax, "IMax", OCC::Binary, "binary", {false, false, false, false, false, false, true, true, true, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -415,19 +415,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Binary, "binary", {false, false, false, false, false, false, true, true, true, false, - false}, + false, false}, Attribute::ReadNone, }, // Binary uint void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::UMax, "UMax", OCC::Binary, "binary", {false, false, false, false, false, false, true, true, true, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -436,31 +436,31 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Binary, "binary", {false, false, false, false, false, false, true, true, true, false, - false}, + false, false}, Attribute::ReadNone, }, // Binary int with two outputs void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj , function attribute + // i32, i64, udt, obj, vec, function attribute { OC::IMul, "IMul", OCC::BinaryWithTwoOuts, "binaryWithTwoOuts", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Binary uint with two outputs void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj , function attribute + // i16, i32, i64, udt, obj, vec, function attribute { OC::UMul, "UMul", OCC::BinaryWithTwoOuts, "binaryWithTwoOuts", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -469,19 +469,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::BinaryWithTwoOuts, "binaryWithTwoOuts", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Binary uint with carry or borrow void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj , function attribute + // i16, i32, i64, udt, obj, vec, function attribute { OC::UAddc, "UAddc", OCC::BinaryWithCarryOrBorrow, "binaryWithCarryOrBorrow", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -490,19 +490,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::BinaryWithCarryOrBorrow, "binaryWithCarryOrBorrow", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Tertiary float void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::FMad, "FMad", OCC::Tertiary, "tertiary", {false, true, true, true, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -511,43 +511,43 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Tertiary, "tertiary", {false, false, false, true, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Tertiary int void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::IMad, "IMad", OCC::Tertiary, "tertiary", {false, false, false, false, false, false, true, true, true, false, - false}, + false, false}, Attribute::ReadNone, }, // Tertiary uint void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::UMad, "UMad", OCC::Tertiary, "tertiary", {false, false, false, false, false, false, true, true, true, false, - false}, + false, false}, Attribute::ReadNone, }, // Tertiary int void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::Msad, "Msad", OCC::Tertiary, "tertiary", {false, false, false, false, false, false, false, true, true, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -556,43 +556,43 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Tertiary, "tertiary", {false, false, false, false, false, false, false, true, true, false, - false}, + false, false}, Attribute::ReadNone, }, // Tertiary uint void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::Ubfe, "Ubfe", OCC::Tertiary, "tertiary", {false, false, false, false, false, false, false, true, true, false, - false}, + false, false}, Attribute::ReadNone, }, // Quaternary void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::Bfi, "Bfi", OCC::Quaternary, "quaternary", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Dot void, h, f, d, i1, i8, i16, i32, i64, udt, - // obj , function attribute + // obj, vec, function attribute { OC::Dot2, "Dot2", OCC::Dot2, "dot2", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -601,7 +601,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Dot3, "dot3", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -610,19 +610,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Dot4, "dot4", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Resources void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::CreateHandle, "CreateHandle", OCC::CreateHandle, "createHandle", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -630,7 +630,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { "CBufferLoad", OCC::CBufferLoad, "cbufferLoad", - {false, true, true, true, false, true, true, true, true, false, false}, + {false, true, true, true, false, true, true, true, true, false, false, + false}, Attribute::ReadOnly, }, { @@ -638,19 +639,20 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { "CBufferLoadLegacy", OCC::CBufferLoadLegacy, "cbufferLoadLegacy", - {false, true, true, true, false, false, true, true, true, false, false}, + {false, true, true, true, false, false, true, true, true, false, false, + false}, Attribute::ReadOnly, }, // Resources - sample void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::Sample, "Sample", OCC::Sample, "sample", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -659,7 +661,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::SampleBias, "sampleBias", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -668,7 +670,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::SampleLevel, "sampleLevel", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -677,7 +679,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::SampleGrad, "sampleGrad", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -686,7 +688,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::SampleCmp, "sampleCmp", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -695,19 +697,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::SampleCmpLevelZero, "sampleCmpLevelZero", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, // Resources void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::TextureLoad, "TextureLoad", OCC::TextureLoad, "textureLoad", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -716,7 +718,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::TextureStore, "textureStore", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::None, }, { @@ -725,7 +727,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::BufferLoad, "bufferLoad", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -734,7 +736,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::BufferStore, "bufferStore", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::None, }, { @@ -743,7 +745,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::BufferUpdateCounter, "bufferUpdateCounter", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -752,7 +754,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::CheckAccessFullyMapped, "checkAccessFullyMapped", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -761,19 +763,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::GetDimensions, "getDimensions", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, // Resources - gather void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::TextureGather, "TextureGather", OCC::TextureGather, "textureGather", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -782,19 +784,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::TextureGatherCmp, "textureGatherCmp", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, // Resources - sample void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::Texture2DMSGetSamplePosition, "Texture2DMSGetSamplePosition", OCC::Texture2DMSGetSamplePosition, "texture2DMSGetSamplePosition", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -803,7 +805,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RenderTargetGetSamplePosition, "renderTargetGetSamplePosition", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -812,19 +814,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RenderTargetGetSampleCount, "renderTargetGetSampleCount", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, // Synchronization void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::AtomicBinOp, "AtomicBinOp", OCC::AtomicBinOp, "atomicBinOp", {false, false, false, false, false, false, false, true, true, false, - false}, + false, false}, Attribute::None, }, { @@ -833,7 +835,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::AtomicCompareExchange, "atomicCompareExchange", {false, false, false, false, false, false, false, true, true, false, - false}, + false, false}, Attribute::None, }, { @@ -842,43 +844,43 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Barrier, "barrier", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::NoDuplicate, }, // Derivatives void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::CalculateLOD, "CalculateLOD", OCC::CalculateLOD, "calculateLOD", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, // Pixel shader void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::Discard, "Discard", OCC::Discard, "discard", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, // Derivatives void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::DerivCoarseX, "DerivCoarseX", OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -887,7 +889,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -896,7 +898,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -905,19 +907,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Pixel shader void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::EvalSnapped, "EvalSnapped", OCC::EvalSnapped, "evalSnapped", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -926,7 +928,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::EvalSampleIndex, "evalSampleIndex", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -935,7 +937,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::EvalCentroid, "evalCentroid", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -944,7 +946,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::SampleIndex, "sampleIndex", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -953,7 +955,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Coverage, "coverage", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -962,19 +964,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::InnerCoverage, "innerCoverage", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Compute/Mesh/Amplification/Node shader void, h, f, d, i1, - // i8, i16, i32, i64, udt, obj , function attribute + // i8, i16, i32, i64, udt, obj, vec, function attribute { OC::ThreadId, "ThreadId", OCC::ThreadId, "threadId", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -983,7 +985,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::GroupId, "groupId", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -992,7 +994,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::ThreadIdInGroup, "threadIdInGroup", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -1001,19 +1003,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::FlattenedThreadIdInGroup, "flattenedThreadIdInGroup", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Geometry shader void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::EmitStream, "EmitStream", OCC::EmitStream, "emitStream", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1022,7 +1024,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::CutStream, "cutStream", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1031,7 +1033,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::EmitThenCutStream, "emitThenCutStream", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1040,19 +1042,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::GSInstanceID, "gsInstanceID", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Double precision void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::MakeDouble, "MakeDouble", OCC::MakeDouble, "makeDouble", {false, false, false, true, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -1061,19 +1063,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::SplitDouble, "splitDouble", {false, false, false, true, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Domain and hull shader void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj , function attribute + // i32, i64, udt, obj, vec, function attribute { OC::LoadOutputControlPoint, "LoadOutputControlPoint", OCC::LoadOutputControlPoint, "loadOutputControlPoint", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -1082,31 +1084,31 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::LoadPatchConstant, "loadPatchConstant", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Domain shader void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::DomainLocation, "DomainLocation", OCC::DomainLocation, "domainLocation", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Hull shader void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::StorePatchConstant, "StorePatchConstant", OCC::StorePatchConstant, "storePatchConstant", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1115,43 +1117,43 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::OutputControlPointID, "outputControlPointID", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Hull, Domain and Geometry shaders void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj , function attribute + // i16, i32, i64, udt, obj, vec, function attribute { OC::PrimitiveID, "PrimitiveID", OCC::PrimitiveID, "primitiveID", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Other void, h, f, d, i1, i8, i16, i32, i64, udt, - // obj , function attribute + // obj, vec, function attribute { OC::CycleCounterLegacy, "CycleCounterLegacy", OCC::CycleCounterLegacy, "cycleCounterLegacy", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, // Wave void, h, f, d, i1, i8, i16, i32, i64, udt, - // obj , function attribute + // obj, vec, function attribute { OC::WaveIsFirstLane, "WaveIsFirstLane", OCC::WaveIsFirstLane, "waveIsFirstLane", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1160,7 +1162,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::WaveGetLaneIndex, "waveGetLaneIndex", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -1169,7 +1171,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::WaveGetLaneCount, "waveGetLaneCount", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -1178,7 +1180,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::WaveAnyTrue, "waveAnyTrue", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1187,7 +1189,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::WaveAllTrue, "waveAllTrue", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1195,7 +1197,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { "WaveActiveAllEqual", OCC::WaveActiveAllEqual, "waveActiveAllEqual", - {false, true, true, true, true, true, true, true, true, false, false}, + {false, true, true, true, true, true, true, true, true, false, false, + false}, Attribute::None, }, { @@ -1204,7 +1207,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::WaveActiveBallot, "waveActiveBallot", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1212,7 +1215,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { "WaveReadLaneAt", OCC::WaveReadLaneAt, "waveReadLaneAt", - {false, true, true, true, true, true, true, true, true, false, false}, + {false, true, true, true, true, true, true, true, true, false, false, + false}, Attribute::None, }, { @@ -1220,7 +1224,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { "WaveReadLaneFirst", OCC::WaveReadLaneFirst, "waveReadLaneFirst", - {false, true, true, true, true, true, true, true, true, false, false}, + {false, true, true, true, true, true, true, true, true, false, false, + false}, Attribute::None, }, { @@ -1228,7 +1233,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { "WaveActiveOp", OCC::WaveActiveOp, "waveActiveOp", - {false, true, true, true, true, true, true, true, true, false, false}, + {false, true, true, true, true, true, true, true, true, false, false, + false}, Attribute::None, }, { @@ -1237,7 +1243,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::WaveActiveBit, "waveActiveBit", {false, false, false, false, false, true, true, true, true, false, - false}, + false, false}, Attribute::None, }, { @@ -1245,18 +1251,20 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { "WavePrefixOp", OCC::WavePrefixOp, "wavePrefixOp", - {false, true, true, true, false, true, true, true, true, false, false}, + {false, true, true, true, false, true, true, true, true, false, false, + false}, Attribute::None, }, // Quad Wave Ops void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::QuadReadLaneAt, "QuadReadLaneAt", OCC::QuadReadLaneAt, "quadReadLaneAt", - {false, true, true, true, true, true, true, true, true, false, false}, + {false, true, true, true, true, true, true, true, true, false, false, + false}, Attribute::None, }, { @@ -1264,19 +1272,20 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { "QuadOp", OCC::QuadOp, "quadOp", - {false, true, true, true, false, true, true, true, true, false, false}, + {false, true, true, true, false, true, true, true, true, false, false, + false}, Attribute::None, }, // Bitcasts with different sizes void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj , function attribute + // i16, i32, i64, udt, obj, vec, function attribute { OC::BitcastI16toF16, "BitcastI16toF16", OCC::BitcastI16toF16, "bitcastI16toF16", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -1285,7 +1294,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::BitcastF16toI16, "bitcastF16toI16", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -1294,7 +1303,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::BitcastI32toF32, "bitcastI32toF32", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -1303,7 +1312,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::BitcastF32toI32, "bitcastF32toI32", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -1312,7 +1321,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::BitcastI64toF64, "bitcastI64toF64", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -1321,19 +1330,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::BitcastF64toI64, "bitcastF64toI64", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Legacy floating-point void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj , function attribute + // i32, i64, udt, obj, vec, function attribute { OC::LegacyF32ToF16, "LegacyF32ToF16", OCC::LegacyF32ToF16, "legacyF32ToF16", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -1342,19 +1351,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::LegacyF16ToF32, "legacyF16ToF32", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Double precision void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::LegacyDoubleToFloat, "LegacyDoubleToFloat", OCC::LegacyDoubleToFloat, "legacyDoubleToFloat", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -1363,7 +1372,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::LegacyDoubleToSInt32, "legacyDoubleToSInt32", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -1372,19 +1381,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::LegacyDoubleToUInt32, "legacyDoubleToUInt32", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Wave void, h, f, d, i1, i8, i16, i32, i64, udt, - // obj , function attribute + // obj, vec, function attribute { OC::WaveAllBitCount, "WaveAllBitCount", OCC::WaveAllOp, "waveAllOp", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1393,42 +1402,43 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::WavePrefixOp, "wavePrefixOp", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, // Pixel shader void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::AttributeAtVertex, "AttributeAtVertex", OCC::AttributeAtVertex, "attributeAtVertex", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Graphics shader void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::ViewID, "ViewID", OCC::ViewID, "viewID", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Resources void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::RawBufferLoad, "RawBufferLoad", OCC::RawBufferLoad, "rawBufferLoad", - {false, true, true, true, false, false, true, true, true, false, false}, + {false, true, true, true, false, false, true, true, true, false, false, + false}, Attribute::ReadOnly, }, { @@ -1436,19 +1446,20 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { "RawBufferStore", OCC::RawBufferStore, "rawBufferStore", - {false, true, true, true, false, false, true, true, true, false, false}, + {false, true, true, true, false, false, true, true, true, false, false, + false}, Attribute::None, }, // Raytracing object space uint System Values void, h, f, d, i1, - // i8, i16, i32, i64, udt, obj , function attribute + // i8, i16, i32, i64, udt, obj, vec, function attribute { OC::InstanceID, "InstanceID", OCC::InstanceID, "instanceID", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -1457,43 +1468,43 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::InstanceIndex, "instanceIndex", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Raytracing hit uint System Values void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj , function attribute + // i16, i32, i64, udt, obj, vec, function attribute { OC::HitKind, "HitKind", OCC::HitKind, "hitKind", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Raytracing uint System Values void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj , function attribute + // i16, i32, i64, udt, obj, vec, function attribute { OC::RayFlags, "RayFlags", OCC::RayFlags, "rayFlags", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Ray Dispatch Arguments void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj , function attribute + // i32, i64, udt, obj, vec, function attribute { OC::DispatchRaysIndex, "DispatchRaysIndex", OCC::DispatchRaysIndex, "dispatchRaysIndex", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -1502,19 +1513,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::DispatchRaysDimensions, "dispatchRaysDimensions", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Ray Vectors void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::WorldRayOrigin, "WorldRayOrigin", OCC::WorldRayOrigin, "worldRayOrigin", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -1523,19 +1534,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::WorldRayDirection, "worldRayDirection", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Ray object space Vectors void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj , function attribute + // i32, i64, udt, obj, vec, function attribute { OC::ObjectRayOrigin, "ObjectRayOrigin", OCC::ObjectRayOrigin, "objectRayOrigin", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -1544,19 +1555,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::ObjectRayDirection, "objectRayDirection", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Ray Transforms void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::ObjectToWorld, "ObjectToWorld", OCC::ObjectToWorld, "objectToWorld", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -1565,19 +1576,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::WorldToObject, "worldToObject", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, // RayT void, h, f, d, i1, i8, i16, i32, i64, udt, - // obj , function attribute + // obj, vec, function attribute { OC::RayTMin, "RayTMin", OCC::RayTMin, "rayTMin", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -1586,19 +1597,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayTCurrent, "rayTCurrent", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, // AnyHit Terminals void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::IgnoreHit, "IgnoreHit", OCC::IgnoreHit, "ignoreHit", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::NoReturn, }, { @@ -1607,19 +1618,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::AcceptHitAndEndSearch, "acceptHitAndEndSearch", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::NoReturn, }, // Indirect Shader Invocation void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj , function attribute + // i32, i64, udt, obj, vec, function attribute { OC::TraceRay, "TraceRay", OCC::TraceRay, "traceRay", {false, false, false, false, false, false, false, false, false, true, - false}, + false, false}, Attribute::None, }, { @@ -1628,7 +1639,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::ReportHit, "reportHit", {false, false, false, false, false, false, false, false, false, true, - false}, + false, false}, Attribute::None, }, { @@ -1637,44 +1648,44 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::CallShader, "callShader", {false, false, false, false, false, false, false, false, false, true, - false}, + false, false}, Attribute::None, }, // Library create handle from resource struct (like HL intrinsic) void, h, - // f, d, i1, i8, i16, i32, i64, udt, obj , function - // attribute + // f, d, i1, i8, i16, i32, i64, udt, obj, vec, + // function attribute { OC::CreateHandleForLib, "CreateHandleForLib", OCC::CreateHandleForLib, "createHandleForLib", {false, false, false, false, false, false, false, false, false, false, - true}, + true, false}, Attribute::ReadOnly, }, // Raytracing object space uint System Values void, h, f, d, i1, - // i8, i16, i32, i64, udt, obj , function attribute + // i8, i16, i32, i64, udt, obj, vec, function attribute { OC::PrimitiveIndex, "PrimitiveIndex", OCC::PrimitiveIndex, "primitiveIndex", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Dot product with accumulate void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj , function attribute + // i32, i64, udt, obj, vec, function attribute { OC::Dot2AddHalf, "Dot2AddHalf", OCC::Dot2AddHalf, "dot2AddHalf", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -1683,7 +1694,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Dot4AddPacked, "dot4AddPacked", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -1692,18 +1703,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Dot4AddPacked, "dot4AddPacked", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Wave void, h, f, d, i1, i8, i16, i32, i64, udt, - // obj , function attribute + // obj, vec, function attribute { OC::WaveMatch, "WaveMatch", OCC::WaveMatch, "waveMatch", - {false, true, true, true, false, true, true, true, true, false, false}, + {false, true, true, true, false, true, true, true, true, false, false, + false}, Attribute::None, }, { @@ -1711,7 +1723,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { "WaveMultiPrefixOp", OCC::WaveMultiPrefixOp, "waveMultiPrefixOp", - {false, true, true, true, false, true, true, true, true, false, false}, + {false, true, true, true, false, true, true, true, true, false, false, + false}, Attribute::None, }, { @@ -1720,19 +1733,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::WaveMultiPrefixBitCount, "waveMultiPrefixBitCount", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, // Mesh shader instructions void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj , function attribute + // i32, i64, udt, obj, vec, function attribute { OC::SetMeshOutputCounts, "SetMeshOutputCounts", OCC::SetMeshOutputCounts, "setMeshOutputCounts", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1741,7 +1754,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::EmitIndices, "emitIndices", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1750,7 +1763,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::GetMeshPayload, "getMeshPayload", {false, false, false, false, false, false, false, false, false, true, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -1759,7 +1772,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::StoreVertexOutput, "storeVertexOutput", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1768,31 +1781,31 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::StorePrimitiveOutput, "storePrimitiveOutput", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::None, }, // Amplification shader instructions void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj , function attribute + // i16, i32, i64, udt, obj, vec, function attribute { OC::DispatchMesh, "DispatchMesh", OCC::DispatchMesh, "dispatchMesh", {false, false, false, false, false, false, false, false, false, true, - false}, + false, false}, Attribute::None, }, // Sampler Feedback void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::WriteSamplerFeedback, "WriteSamplerFeedback", OCC::WriteSamplerFeedback, "writeSamplerFeedback", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1801,7 +1814,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::WriteSamplerFeedbackBias, "writeSamplerFeedbackBias", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1810,7 +1823,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::WriteSamplerFeedbackLevel, "writeSamplerFeedbackLevel", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1819,19 +1832,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::WriteSamplerFeedbackGrad, "writeSamplerFeedbackGrad", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, // Inline Ray Query void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::AllocateRayQuery, "AllocateRayQuery", OCC::AllocateRayQuery, "allocateRayQuery", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1840,7 +1853,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_TraceRayInline, "rayQuery_TraceRayInline", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1849,7 +1862,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_Proceed, "rayQuery_Proceed", {false, false, false, false, true, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1858,7 +1871,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_Abort, "rayQuery_Abort", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1867,7 +1880,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_CommitNonOpaqueTriangleHit, "rayQuery_CommitNonOpaqueTriangleHit", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1876,7 +1889,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_CommitProceduralPrimitiveHit, "rayQuery_CommitProceduralPrimitiveHit", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -1885,7 +1898,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateScalar, "rayQuery_StateScalar", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -1894,7 +1907,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateScalar, "rayQuery_StateScalar", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -1903,7 +1916,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateMatrix, "rayQuery_StateMatrix", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -1912,7 +1925,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateMatrix, "rayQuery_StateMatrix", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -1921,7 +1934,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateMatrix, "rayQuery_StateMatrix", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -1930,7 +1943,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateMatrix, "rayQuery_StateMatrix", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -1939,7 +1952,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateScalar, "rayQuery_StateScalar", {false, false, false, false, true, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -1948,7 +1961,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateScalar, "rayQuery_StateScalar", {false, false, false, false, true, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -1957,7 +1970,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateScalar, "rayQuery_StateScalar", {false, false, false, false, true, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -1966,7 +1979,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateVector, "rayQuery_StateVector", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -1975,7 +1988,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateVector, "rayQuery_StateVector", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -1984,7 +1997,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateScalar, "rayQuery_StateScalar", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -1993,7 +2006,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateVector, "rayQuery_StateVector", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -2002,7 +2015,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateVector, "rayQuery_StateVector", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -2011,7 +2024,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateScalar, "rayQuery_StateScalar", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -2020,7 +2033,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateScalar, "rayQuery_StateScalar", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -2029,7 +2042,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateScalar, "rayQuery_StateScalar", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -2038,7 +2051,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateScalar, "rayQuery_StateScalar", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -2047,7 +2060,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateScalar, "rayQuery_StateScalar", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -2056,7 +2069,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateScalar, "rayQuery_StateScalar", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -2065,7 +2078,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateScalar, "rayQuery_StateScalar", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -2074,7 +2087,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateVector, "rayQuery_StateVector", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -2083,7 +2096,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateVector, "rayQuery_StateVector", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -2092,7 +2105,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateScalar, "rayQuery_StateScalar", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -2101,7 +2114,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateScalar, "rayQuery_StateScalar", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -2110,7 +2123,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateScalar, "rayQuery_StateScalar", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -2119,7 +2132,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateScalar, "rayQuery_StateScalar", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -2128,7 +2141,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateVector, "rayQuery_StateVector", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -2137,32 +2150,32 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateVector, "rayQuery_StateVector", {false, false, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, // Raytracing object space uint System Values, raytracing tier 1.1 void, h, - // f, d, i1, i8, i16, i32, i64, udt, obj , function - // attribute + // f, d, i1, i8, i16, i32, i64, udt, obj, vec, + // function attribute { OC::GeometryIndex, "GeometryIndex", OCC::GeometryIndex, "geometryIndex", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Inline Ray Query void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::RayQuery_CandidateInstanceContributionToHitGroupIndex, "RayQuery_CandidateInstanceContributionToHitGroupIndex", OCC::RayQuery_StateScalar, "rayQuery_StateScalar", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -2171,19 +2184,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::RayQuery_StateScalar, "rayQuery_StateScalar", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadOnly, }, // Get handle from heap void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::AnnotateHandle, "AnnotateHandle", OCC::AnnotateHandle, "annotateHandle", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -2192,7 +2205,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::CreateHandleFromBinding, "createHandleFromBinding", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -2201,102 +2214,102 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::CreateHandleFromHeap, "createHandleFromHeap", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Unpacking intrinsics void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::Unpack4x8, "Unpack4x8", OCC::Unpack4x8, "unpack4x8", {false, false, false, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Packing intrinsics void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::Pack4x8, "Pack4x8", OCC::Pack4x8, "pack4x8", {false, false, false, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Helper Lanes void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::IsHelperLane, "IsHelperLane", OCC::IsHelperLane, "isHelperLane", {false, false, false, false, true, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, // Quad Wave Ops void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::QuadVote, "QuadVote", OCC::QuadVote, "quadVote", {false, false, false, false, true, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, // Resources - gather void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::TextureGatherRaw, "TextureGatherRaw", OCC::TextureGatherRaw, "textureGatherRaw", {false, false, false, false, false, false, true, true, true, false, - false}, + false, false}, Attribute::ReadOnly, }, // Resources - sample void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::SampleCmpLevel, "SampleCmpLevel", OCC::SampleCmpLevel, "sampleCmpLevel", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, // Resources void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj , function attribute + // udt, obj, vec, function attribute { OC::TextureStoreSample, "TextureStoreSample", OCC::TextureStoreSample, "textureStoreSample", {false, true, true, false, false, false, true, true, false, false, - false}, + false, false}, Attribute::None, }, - // void, h, f, d, i1, i8, i16, i32, i64, udt, obj , function attribute + // void, h, f, d, i1, i8, i16, i32, i64, udt, obj, vec, function attribute { OC::Reserved0, "Reserved0", OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2305,7 +2318,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2314,7 +2327,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2323,7 +2336,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2332,7 +2345,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2341,7 +2354,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2350,7 +2363,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2359,7 +2372,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2368,7 +2381,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2377,7 +2390,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2386,7 +2399,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2395,43 +2408,43 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, // Create/Annotate Node Handles void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj , function attribute + // i16, i32, i64, udt, obj, vec, function attribute { OC::AllocateNodeOutputRecords, "AllocateNodeOutputRecords", OCC::AllocateNodeOutputRecords, "allocateNodeOutputRecords", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, // Get Pointer to Node Record in Address Space 6 void, h, f, d, - // i1, i8, i16, i32, i64, udt, obj , function attribute + // i1, i8, i16, i32, i64, udt, obj, vec, function attribute { OC::GetNodeRecordPtr, "GetNodeRecordPtr", OCC::GetNodeRecordPtr, "getNodeRecordPtr", {false, false, false, false, false, false, false, false, false, true, - false}, + false, false}, Attribute::ReadNone, }, // Work Graph intrinsics void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj , function attribute + // i32, i64, udt, obj, vec, function attribute { OC::IncrementOutputCount, "IncrementOutputCount", OCC::IncrementOutputCount, "incrementOutputCount", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2440,7 +2453,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::OutputComplete, "outputComplete", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2449,7 +2462,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::GetInputRecordCount, "getInputRecordCount", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -2458,19 +2471,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::FinishedCrossGroupSharing, "finishedCrossGroupSharing", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, // Synchronization void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::BarrierByMemoryType, "BarrierByMemoryType", OCC::BarrierByMemoryType, "barrierByMemoryType", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::NoDuplicate, }, { @@ -2479,7 +2492,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::BarrierByMemoryHandle, "barrierByMemoryHandle", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::NoDuplicate, }, { @@ -2488,19 +2501,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::BarrierByNodeRecordHandle, "barrierByNodeRecordHandle", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::NoDuplicate, }, // Create/Annotate Node Handles void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj , function attribute + // i16, i32, i64, udt, obj, vec, function attribute { OC::CreateNodeOutputHandle, "CreateNodeOutputHandle", OCC::createNodeOutputHandle, "createNodeOutputHandle", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -2509,7 +2522,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::IndexNodeHandle, "indexNodeHandle", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -2518,7 +2531,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::AnnotateNodeHandle, "annotateNodeHandle", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -2527,7 +2540,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::CreateNodeInputRecordHandle, "createNodeInputRecordHandle", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -2536,19 +2549,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::AnnotateNodeRecordHandle, "annotateNodeRecordHandle", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Work Graph intrinsics void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj , function attribute + // i32, i64, udt, obj, vec, function attribute { OC::NodeOutputIsValid, "NodeOutputIsValid", OCC::NodeOutputIsValid, "nodeOutputIsValid", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -2557,19 +2570,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::GetRemainingRecursionLevels, "getRemainingRecursionLevels", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, // Comparison Samples void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::SampleCmpGrad, "SampleCmpGrad", OCC::SampleCmpGrad, "sampleCmpGrad", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, { @@ -2578,19 +2591,19 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::SampleCmpBias, "sampleCmpBias", {false, true, true, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::ReadOnly, }, // Extended Command Information void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj , function attribute + // i16, i32, i64, udt, obj, vec, function attribute { OC::StartVertexLocation, "StartVertexLocation", OCC::StartVertexLocation, "startVertexLocation", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, { @@ -2599,30 +2612,30 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::StartInstanceLocation, "startInstanceLocation", {false, false, false, false, false, false, false, true, false, false, - false}, + false, false}, Attribute::ReadNone, }, // Inline Ray Query void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj , function attribute + // i64, udt, obj, vec, function attribute { OC::AllocateRayQuery2, "AllocateRayQuery2", OCC::AllocateRayQuery2, "allocateRayQuery2", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, - // void, h, f, d, i1, i8, i16, i32, i64, udt, obj , function attribute + // void, h, f, d, i1, i8, i16, i32, i64, udt, obj, vec, function attribute { OC::ReservedA0, "ReservedA0", OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2631,7 +2644,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2640,7 +2653,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2649,7 +2662,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2658,7 +2671,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2667,7 +2680,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2676,7 +2689,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2685,7 +2698,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2694,7 +2707,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2703,7 +2716,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2712,7 +2725,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2721,7 +2734,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2730,7 +2743,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2739,7 +2752,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2748,7 +2761,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2757,7 +2770,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2766,7 +2779,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2775,7 +2788,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2784,7 +2797,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2793,7 +2806,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2802,7 +2815,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2811,7 +2824,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2820,7 +2833,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2829,7 +2842,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2838,7 +2851,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2847,7 +2860,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2856,7 +2869,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2865,7 +2878,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2874,7 +2887,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2883,7 +2896,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2892,7 +2905,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2901,7 +2914,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2910,7 +2923,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2919,7 +2932,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2928,7 +2941,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2937,7 +2950,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2946,7 +2959,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2955,7 +2968,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2964,7 +2977,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2973,7 +2986,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2982,7 +2995,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -2991,7 +3004,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -3000,7 +3013,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, Attribute::None, }, { @@ -3009,7 +3022,25 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Reserved, "reserved", {true, false, false, false, false, false, false, false, false, false, - false}, + false, false}, + Attribute::None, + }, + { + OC::RawBufferVectorLoad, + "RawBufferVectorLoad", + OCC::RawBufferVectorLoad, + "rawBufferVectorLoad", + {false, false, false, false, false, false, false, false, false, false, + false, true}, + Attribute::ReadOnly, + }, + { + OC::RawBufferVectorStore, + "RawBufferVectorStore", + OCC::RawBufferVectorStore, + "rawBufferVectorStore", + {false, false, false, false, false, false, false, false, false, false, + false, true}, Attribute::None, }, }; @@ -3017,7 +3048,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { const char *OP::m_OverloadTypeName[kNumTypeOverloads] = { "void", "f16", "f32", "f64", "i1", "i8", - "i16", "i32", "i64", "udt", "obj", // These should not be used + "i16", "i32", "i64", "udt", "obj", // "udt" and "obj" should not be used }; const char *OP::m_NamePrefix = "dx.op."; @@ -3068,6 +3099,8 @@ unsigned OP::GetTypeSlot(Type *pType) { } case Type::StructTyID: return kObjectTypeSlot; + case Type::VectorTyID: + return kVectorTypeSlot; default: break; } @@ -3091,6 +3124,12 @@ llvm::StringRef OP::GetTypeName(Type *Ty, std::string &str) { } else if (TypeSlot == kObjectTypeSlot) { StructType *ST = cast(Ty); return ST->getStructName(); + } else if (TypeSlot == kVectorTypeSlot) { + VectorType *VecTy = cast(Ty); + str = "v"; + str += std::to_string(VecTy->getNumElements()); + str += GetOverloadTypeName(OP::GetTypeSlot(VecTy->getElementType())); + return str; } else { raw_string_ostream os(str); Ty->print(os); @@ -6023,6 +6062,23 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { A(pV); A(pI32); break; + case OpCode::RawBufferVectorLoad: + RRT(pETy); + A(pI32); + A(pRes); + A(pI32); + A(pI32); + A(pI32); + break; + case OpCode::RawBufferVectorStore: + A(pV); + A(pI32); + A(pRes); + A(pI32); + A(pI32); + A(pETy); + A(pI32); + break; // OPCODE-OLOAD-FUNCS:END default: DXASSERT(false, "otherwise unhandled case"); @@ -6171,6 +6227,7 @@ llvm::Type *OP::GetOverloadType(OpCode opCode, llvm::Function *F) { case OpCode::StoreVertexOutput: case OpCode::StorePrimitiveOutput: case OpCode::DispatchMesh: + case OpCode::RawBufferVectorStore: if (FT->getNumParams() <= 4) return nullptr; return FT->getParamType(4); @@ -6417,7 +6474,8 @@ llvm::Type *OP::GetOverloadType(OpCode opCode, llvm::Function *F) { case OpCode::TextureGatherRaw: case OpCode::SampleCmpLevel: case OpCode::SampleCmpGrad: - case OpCode::SampleCmpBias: { + case OpCode::SampleCmpBias: + case OpCode::RawBufferVectorLoad: { StructType *ST = cast(Ty); return ST->getElementType(0); } @@ -6472,7 +6530,15 @@ bool OP::IsResRetType(llvm::Type *Ty) { Type *OP::GetResRetType(Type *pOverloadType) { unsigned TypeSlot = GetTypeSlot(pOverloadType); - if (m_pResRetType[TypeSlot] == nullptr) { + if (TypeSlot == kVectorTypeSlot) { + string TypeName("dx.types.ResRet."); + VectorType *VecTy = cast(pOverloadType); + TypeName += "v"; + TypeName += std::to_string(VecTy->getNumElements()); + TypeName += GetOverloadTypeName(OP::GetTypeSlot(VecTy->getElementType())); + Type *FieldTypes[2] = {pOverloadType, Type::getInt32Ty(m_Ctx)}; + return GetOrCreateStructType(m_Ctx, FieldTypes, TypeName, m_pModule); + } else if (m_pResRetType[TypeSlot] == nullptr) { string TypeName("dx.types.ResRet."); TypeName += GetOverloadTypeName(TypeSlot); Type *FieldTypes[5] = {pOverloadType, pOverloadType, pOverloadType, diff --git a/lib/DxilValidation/DxilValidation.cpp b/lib/DxilValidation/DxilValidation.cpp index a9c36b3b13..9c93b70cce 100644 --- a/lib/DxilValidation/DxilValidation.cpp +++ b/lib/DxilValidation/DxilValidation.cpp @@ -2037,7 +2037,7 @@ static void ValidateExternalFunction(Function *F, ValidationContext &ValCtx) { ValCtx.EmitInstrError(CI, ValidationRule::InstrOload); continue; } - dxilFunc = hlslOP->GetOpFunc(dxilOpcode, Ty->getScalarType()); + dxilFunc = hlslOP->GetOpFunc(dxilOpcode, Ty); } if (!dxilFunc) { @@ -2109,17 +2109,20 @@ static bool IsDxilBuiltinStructType(StructType *ST, hlsl::OP *hlslOP) { return true; unsigned EltNum = ST->getNumElements(); + Type *EltTy = ST->getElementType(0); switch (EltNum) { case 2: + // Check if it's a native vector resret. + if (EltTy->isVectorTy()) + return ST == hlslOP->GetResRetType(EltTy); + LLVM_FALLTHROUGH; case 4: - case 8: { // 2 for doubles, 8 for halfs. - Type *EltTy = ST->getElementType(0); + case 8: // 2 for doubles, 8 for halfs. return ST == hlslOP->GetCBufferRetType(EltTy); - } break; - case 5: { - Type *EltTy = ST->getElementType(0); + break; + case 5: return ST == hlslOP->GetResRetType(EltTy); - } break; + break; default: return false; } diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 4c2294b2a6..9bafaabea3 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -5586,6 +5586,83 @@ def UFI(name, **mappings): # Reserved block C next_op_idx = self.reserve_dxil_op_range("ReservedC", next_op_idx, 10) + # Long Vectors + self.add_dxil_op( + "RawBufferVectorLoad", + next_op_idx, + "RawBufferVectorLoad", + "reads from a raw buffer and structured buffer", + "t", + "ro", + [ + db_dxil_param(0, "$r", "", "the loaded value"), + db_dxil_param(2, "res", "srv", "handle of TypedBuffer SRV to sample"), + db_dxil_param( + 3, + "i32", + "index", + "element index for StructuredBuffer, or byte offset for ByteAddressBuffer", + ), + db_dxil_param( + 4, + "i32", + "elementOffset", + "offset into element for StructuredBuffer, or undef for ByteAddressBuffer", + ), + db_dxil_param( + 5, + "i32", + "alignment", + "relative load access alignment", + is_const=True, + ), + ], + counters=("tex_load",), + ) + next_op_idx += 1 + + self.add_dxil_op( + "RawBufferVectorStore", + next_op_idx, + "RawBufferVectorStore", + "writes to a RWByteAddressBuffer or RWStructuredBuffer", + "t", + "", + [ + db_dxil_param(0, "v", "", ""), + db_dxil_param(2, "res", "uav", "handle of UAV to store to"), + db_dxil_param( + 3, + "i32", + "index", + "element index for StructuredBuffer, or byte offset for ByteAddressBuffer", + ), + db_dxil_param( + 4, + "i32", + "elementOffset", + "offset into element for StructuredBuffer, or undef for ByteAddressBuffer", + ), + db_dxil_param(5, "$o", "value0", "value"), + db_dxil_param( + 6, + "i32", + "alignment", + "relative store access alignment", + is_const=True, + ), + ], + counters=("tex_store",), + ) + next_op_idx += 1 + + # End of DXIL 1.9 opcodes. + self.set_op_count_for_version(1, 9, next_op_idx) + assert next_op_idx == 305, ( + "260 is expected next operation index but encountered %d and thus opcodes are broken" + % next_op_idx + ) + # Set interesting properties. self.build_indices() for ( diff --git a/utils/hct/hctdb_instrhelp.py b/utils/hct/hctdb_instrhelp.py index 17eefd4918..12ce6f8544 100644 --- a/utils/hct/hctdb_instrhelp.py +++ b/utils/hct/hctdb_instrhelp.py @@ -487,7 +487,7 @@ def print_opfunc_props(self): ) ) print( - "// OpCode OpCode name, OpCodeClass OpCodeClass name, void, h, f, d, i1, i8, i16, i32, i64, udt, obj, function attribute" + "// OpCode OpCode name, OpCodeClass OpCodeClass name, void, h, f, d, i1, i8, i16, i32, i64, udt, obj, vec, function attribute" ) # Example formatted string: # { OC::TempRegLoad, "TempRegLoad", OCC::TempRegLoad, "tempRegLoad", false, true, true, false, true, false, true, true, false, Attribute::ReadOnly, }, @@ -495,7 +495,7 @@ def print_opfunc_props(self): # 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 last_category = None - # overload types are a string of (v)oid, (h)alf, (f)loat, (d)ouble, (1)-bit, (8)-bit, (w)ord, (i)nt, (l)ong, u(dt) + # overload types are a string of (v)oid, (h)alf, (f)loat, (d)ouble, (1)-bit, (8)-bit, (w)ord, (i)nt, (l)ong, u(dt), o(bj), vec(t)or f = lambda i, c: "true" if i.oload_types.find(c) >= 0 else "false" lower_exceptions = { "CBufferLoad": "cbufferLoad", @@ -522,13 +522,13 @@ def print_opfunc_props(self): if last_category != None: print("") print( - " // {category:118} void, h, f, d, i1, i8, i16, i32, i64, udt, obj , function attribute".format( + " // {category:118} void, h, f, d, i1, i8, i16, i32, i64, udt, obj, vec, function attribute".format( category=i.category ) ) last_category = i.category print( - " {{ {OC}::{name:24} {quotName:27} {OCC}::{className:25} {classNameQuot:28} {{{v:>6},{h:>6},{f:>6},{d:>6},{b:>6},{e:>6},{w:>6},{i:>6},{l:>6},{u:>6},{o:>6}}}, {attr:20} }},".format( + " {{ {OC}::{name:24} {quotName:27} {OCC}::{className:25} {classNameQuot:28} {{{v:>6},{h:>6},{f:>6},{d:>6},{b:>6},{e:>6},{w:>6},{i:>6},{l:>6},{u:>6},{o:>6},{t:>6}}}, {attr:20} }},".format( name=i.name + ",", quotName='"' + i.name + '",', className=i.dxil_class + ",", @@ -544,6 +544,7 @@ def print_opfunc_props(self): l=f(i, "l"), u=f(i, "u"), o=f(i, "o"), + t=f(i, "t"), attr=attr_fn(i), OC=self.OC, OCC=self.OCC, @@ -710,6 +711,7 @@ def print_opfunc_oload_type(self): "v": "Type::getVoidTy(Ctx)", "u": "Type::getInt32PtrTy(Ctx)", "o": "Type::getInt32PtrTy(Ctx)", + "t": "Type::getInt32PtrTy(Ctx)", } assert ty in type_code_texts, "llvm type %s is unknown" % (ty) ty_code = type_code_texts[ty] From 50ea061616fc8c2c49f55af18d9f0fd08c73dcc6 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Mon, 10 Mar 2025 02:34:58 -0600 Subject: [PATCH 26/45] Generate native vector raw buffers load/stores When the loaded/stored type is a vector of more than 1 element, the shader model is 6.9 or higher, and the operation is on a raw buffer, enable the generation of a native vector raw buffer load or store. --- lib/HLSL/HLOperationLower.cpp | 127 ++++++++++++++++++++++++---------- 1 file changed, 89 insertions(+), 38 deletions(-) diff --git a/lib/HLSL/HLOperationLower.cpp b/lib/HLSL/HLOperationLower.cpp index cf0db42ac2..d53f41c206 100644 --- a/lib/HLSL/HLOperationLower.cpp +++ b/lib/HLSL/HLOperationLower.cpp @@ -481,6 +481,26 @@ Value *TrivialDxilOperation(OP::OpCode opcode, ArrayRef refArgs, return TrivialDxilOperation(opcode, refArgs, Ty, Inst->getType(), hlslOP, B); } +Value *TrivialDxilVectorOperation(OP::OpCode opcode, Value *src, + OP *hlslOP, IRBuilder<> &Builder) { + + Type *Ty = src->getType(); + + Constant *opArg = hlslOP->GetU32Const((unsigned)opcode); + Value *args[] = {opArg, src}; + + Function *dxilFunc = hlslOP->GetOpFunc(opcode, Ty); + + if (!Ty->isVoidTy()) { + Value *retVal = + Builder.CreateCall(dxilFunc, args, hlslOP->GetOpCodeName(opcode)); + return retVal; + } else { + // Cannot add name to void. + return Builder.CreateCall(dxilFunc, args); + } +} + Value *TrivialDxilUnaryOperationRet(OP::OpCode opcode, Value *src, Type *RetTy, hlsl::OP *hlslOP, IRBuilder<> &Builder) { Type *Ty = src->getType(); @@ -2211,8 +2231,11 @@ Value *TranslateExp(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, ConstantVector::getSplat(Ty->getVectorNumElements(), log2eConst); } val = Builder.CreateFMul(log2eConst, val); - Value *exp = TrivialDxilUnaryOperation(OP::OpCode::Exp, val, hlslOP, Builder); - return exp; + if (val->getType()->isVectorTy() && + hlslOP->GetModule()->GetHLModule().GetShaderModel()->IsSM69Plus()) + return TrivialDxilVectorOperation(OP::OpCode::Exp, val, hlslOP, Builder); + else + return TrivialDxilUnaryOperation(OP::OpCode::Exp, val, hlslOP, Builder); } Value *TranslateLog(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, @@ -3970,6 +3993,11 @@ struct ResLoadHelper { : intrinsicOpCode(IntrinsicOp::Num_Intrinsics), handle(h), retVal(ldInst), addr(idx), offset(Offset), status(nullptr), mipLevel(mip) { opcode = LoadOpFromResKind(RK); + if (opcode == OP::OpCode::RawBufferLoad && + ldInst->getType()->isVectorTy() && + ldInst->getType()->getVectorNumElements() > 1 && + ldInst->getModule()->GetHLModule().GetShaderModel()->IsSM69Plus()) + opcode = OP::OpCode::RawBufferVectorLoad; } OP::OpCode opcode; IntrinsicOp intrinsicOpCode; @@ -4063,6 +4091,11 @@ ResLoadHelper::ResLoadHelper(CallInst *CI, DxilResource::Kind RK, status = CI->getArgOperand(kStatusIdx); } } else { + if (opcode == OP::OpCode::RawBufferLoad && + CI->getType()->isVectorTy() && + CI->getType()->getVectorNumElements() > 1 && + CI->getModule()->GetHLModule().GetShaderModel()->IsSM69Plus()) + opcode = OP::OpCode::RawBufferVectorLoad; const unsigned kStatusIdx = HLOperandIndex::kBufLoadStatusOpIdx; if (argc > kStatusIdx) status = CI->getArgOperand(kStatusIdx); @@ -4168,11 +4201,16 @@ static SmallVector GetBufLoadArgs(ResLoadHelper helper, isVectorAddr ? Builder.CreateExtractElement(helper.addr, (uint64_t)0) : helper.addr); Args.emplace_back(helper.offset); // offset (may be changed later) @3 + if (opcode == OP::OpCode::RawBufferLoad) { // Unlike typed buffer load, raw buffer load has mask and alignment. Args.emplace_back(nullptr); // mask (to be added later) @4 Args.emplace_back(alignmentVal); // alignment @5 + } else if (opcode == OP::OpCode::RawBufferVectorLoad) { + // RawBufferVectorLoad takes no mask argument. + Args.emplace_back(alignmentVal); // alignment @4 } + } return Args; } @@ -4208,42 +4246,50 @@ Value *TranslateBufLoad(ResLoadHelper &helper, HLResource::Kind RK, const unsigned kMaskIdx = 4; // Keep track of the first load for debug info migration. - Value *firstLd = nullptr; - // Create calls to function object. - // Typed buffer loads are limited to one load of up to 4 32-bit values. - // Raw buffer loads might need multiple loads in chunks of 4. - for (unsigned i = 0; i < numComponents;) { - unsigned chunkSize = (numComponents - i) <= 4 ? numComponents - i : 4; - - // Assign mask for raw buffer loads. - if (opcode == OP::OpCode::RawBufferLoad) - Args[kMaskIdx] = GetRawBufferMaskForETy(MemTy, chunkSize, OP); - - Value *Ld = GenerateBufLd(OP, Builder, opcode, Ty->getScalarType(), MemTy, - chunkSize, Args, elts.begin() + i); - i += chunkSize; - - // Update status. - UpdateStatus(Ld, helper.status, Builder, OP); - - if (!firstLd) - firstLd = Ld; - - if (opcode == OP::OpCode::RawBufferLoad && i < numComponents) { - if (RK == DxilResource::Kind::RawBuffer) - // Raw buffers can't use offset param. Add to coord index. - Args[kCoordIdx] = - Builder.CreateAdd(Args[kCoordIdx], OP->GetU32Const(4 * LdSize)); - else - // Structured buffers increment the offset parameter. - Args[kOffsetIdx] = - Builder.CreateAdd(Args[kOffsetIdx], OP->GetU32Const(4 * LdSize)); + Value *FirstLd = nullptr; + Value *retValNew = nullptr; + if (opcode == OP::OpCode::RawBufferVectorLoad) { + FirstLd = GenerateBufLd(OP, Builder, opcode, Ty->getScalarType(), + VectorType::get(MemTy, numComponents), 1, Args, + elts.begin()); + UpdateStatus(FirstLd, helper.status, Builder, OP); + retValNew = elts[0]; + } else { + // Create calls to function object. + // Typed buffer loads are limited to one load of up to 4 32-bit values. + // Raw buffer loads might need multiple loads in chunks of 4. + for (unsigned i = 0; i < numComponents;) { + unsigned chunkSize = (numComponents - i) <= 4 ? numComponents - i : 4; + + // Assign mask for raw buffer loads. + if (opcode == OP::OpCode::RawBufferLoad) + Args[kMaskIdx] = GetRawBufferMaskForETy(MemTy, chunkSize, OP); + + Value *Ld = GenerateBufLd(OP, Builder, opcode, Ty->getScalarType(), MemTy, + chunkSize, Args, elts.begin() + i); + i += chunkSize; + + // Update status. + UpdateStatus(Ld, helper.status, Builder, OP); + + if (!FirstLd) + FirstLd = Ld; + + if (opcode == OP::OpCode::RawBufferLoad && i < numComponents) { + if (RK == DxilResource::Kind::RawBuffer) + // Raw buffers can't use offset param. Add to coord index. + Args[kCoordIdx] = + Builder.CreateAdd(Args[kCoordIdx], OP->GetU32Const(4 * LdSize)); + else + // Structured buffers increment the offset parameter. + Args[kOffsetIdx] = + Builder.CreateAdd(Args[kOffsetIdx], OP->GetU32Const(4 * LdSize)); + } } + retValNew = ScalarizeElements(Ty, elts, Builder); } - Value *retValNew = ScalarizeElements(Ty, elts, Builder); - - DXASSERT(firstLd, "No loads created by TranslateBufLoad"); + DXASSERT(FirstLd, "No loads created by TranslateBufLoad"); if (isBool) { // Convert result back to register representation. @@ -4254,7 +4300,7 @@ Value *TranslateBufLoad(ResLoadHelper &helper, HLResource::Kind RK, helper.retVal->replaceAllUsesWith(retValNew); helper.retVal = retValNew; - return firstLd; + return FirstLd; } Value *TranslateResourceLoad(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, @@ -7856,8 +7902,13 @@ static Value *GenerateBufLd(hlsl::OP *OP, IRBuilder<> &Builder, return Ld; } - for (unsigned i = 0; i < NumElements; i++, EltIt++) - *EltIt = Builder.CreateExtractValue(Ld, i); + if (opcode == OP::OpCode::RawBufferVectorLoad) { + DXASSERT(RegTy != Builder.getInt64Ty() && RegTy != Builder.getDoubleTy(), + "64-bit type conversions for longvecs requires op support"); + *EltIt = Builder.CreateExtractValue(Ld, 0); + } else + for (unsigned i = 0; i < NumElements; i++, EltIt++) + *EltIt = Builder.CreateExtractValue(Ld, i); return Ld; } From b90a97d0f7400b4be86b18c93007eeb735ed4056 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Fri, 7 Mar 2025 00:25:35 -0700 Subject: [PATCH 27/45] Add sm69 load store test --- .../intrinsics/buffer-load-stores-sm69.hlsl | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 tools/clang/test/CodeGenDXIL/hlsl/intrinsics/buffer-load-stores-sm69.hlsl diff --git a/tools/clang/test/CodeGenDXIL/hlsl/intrinsics/buffer-load-stores-sm69.hlsl b/tools/clang/test/CodeGenDXIL/hlsl/intrinsics/buffer-load-stores-sm69.hlsl new file mode 100644 index 0000000000..18bec196e4 --- /dev/null +++ b/tools/clang/test/CodeGenDXIL/hlsl/intrinsics/buffer-load-stores-sm69.hlsl @@ -0,0 +1,138 @@ +// RUN: %dxc -DTYPE=float -DNUM=4 -T vs_6_9 %s | FileCheck %s +// RUN: %dxc -DTYPE=bool -DNUM=4 -T vs_6_9 %s | FileCheck %s --check-prefixes=CHECK,I1 + +// 64-bit types require operation/intrinsic support to convert the values to/from the i32 memory representations. +// RUN: %dxc -DTYPE=uint64_t -DNUM=2 -T vs_6_9 %s | FileCheck %s --check-prefixes=CHECK,I64 +// RUN: %dxc -DTYPE=double -DNUM=2 -T vs_6_9 %s | FileCheck %s --check-prefixes=CHECK,F64 + +/////////////////////////////////////////////////////////////////////// +// Test codegen for various load and store operations and conversions +// for different scalar/vector buffer types and indices. +/////////////////////////////////////////////////////////////////////// + +// CHECK-DAG: %dx.types.ResRet.[[VTY:v[0-9]*[a-z][0-9][0-9]]] = type { [[VTYPE:<[a-z 0-9]*>]], +// CHECK-DAG: %dx.types.ResRet.[[TY:[if][0-9][0-9]]] = type +// CHECK: %"class.StructuredBuffer + + ByteAddressBuffer RoByBuf : register(t1); +RWByteAddressBuffer RwByBuf : register(u1); + +StructuredBuffer< vector > RoStBuf : register(t2); +RWStructuredBuffer< vector > RwStBuf : register(u2); + + Buffer< vector > RoTyBuf : register(t3); +RWBuffer< vector > RwTyBuf : register(u3); + +ConsumeStructuredBuffer > CnStBuf : register(u4); +AppendStructuredBuffer > ApStBuf : register(u5); + +void main(uint ix[2] : IX) { + // ByteAddressBuffer Tests + + // CHECK-DAG: [[HDLROBY:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 1, i32 1, i32 0, i8 0 }, i32 1, i1 false) + // CHECK-DAG: [[HDLRWBY:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 1, i32 1, i32 0, i8 1 }, i32 1, i1 false) + + // CHECK-DAG: [[HDLROST:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 2, i32 2, i32 0, i8 0 }, i32 2, i1 false) + // CHECK-DAG: [[HDLRWST:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 2, i32 2, i32 0, i8 1 }, i32 2, i1 false) + + // CHECK-DAG: [[HDLROTY:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 3, i32 3, i32 0, i8 0 }, i32 3, i1 false) + // CHECK-DAG: [[HDLRWTY:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 3, i32 3, i32 0, i8 1 }, i32 3, i1 false) + + // CHECK-DAG: [[HDLCON:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 4, i32 4, i32 0, i8 1 }, i32 4, i1 false) + // CHECK-DAG: [[HDLAPP:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 5, i32 5, i32 0, i8 1 }, i32 5, i1 false) + + // CHECK: [[IX0:%.*]] = call i32 @dx.op.loadInput.i32(i32 4, + + // CHECK: [[ANHDLRWBY:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLRWBY]] + // CHECK: call %dx.types.ResRet.[[VTY]] @dx.op.rawBufferVectorLoad.[[VTY]](i32 303, %dx.types.Handle [[ANHDLRWBY]], i32 [[IX0]] + // I1: icmp ne [[VTYPE]] %{{.*}}, zeroinitializer + vector babElt1 = RwByBuf.Load< vector >(ix[0]); + + // CHECK: [[ANHDLROBY:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLROBY]] + // CHECK: call %dx.types.ResRet.[[VTY]] @dx.op.rawBufferVectorLoad.[[VTY]](i32 303, %dx.types.Handle [[ANHDLROBY]], i32 [[IX0]] + // I1: icmp ne [[VTYPE]] %{{.*}}, zeroinitializer + vector babElt2 = RoByBuf.Load< vector >(ix[0]); + + // I1: zext <[[NUM]] x i1> %{{.*}} to [[VTYPE]] + // CHoCK: all void @dx.op.rawBufferStore.[[TY]](i32 140, %dx.types.Handle [[ANHDLRWBY]], i32 [[IX0]] + RwByBuf.Store< vector >(ix[0], babElt1 + babElt2); + + // StructuredBuffer Tests + // CHECK: [[ANHDLRWST:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLRWST]] + // CHECK: call %dx.types.ResRet.[[VTY]] @dx.op.rawBufferVectorLoad.[[VTY]](i32 303, %dx.types.Handle [[ANHDLRWST]], i32 [[IX0]] + // I1: icmp ne [[VTYPE]] %{{.*}}, zeroinitializer + vector stbElt1 = RwStBuf.Load(ix[0]); + // CHECK: [[IX1:%.*]] = call i32 @dx.op.loadInput.i32(i32 4, + // CHECK: call %dx.types.ResRet.[[VTY]] @dx.op.rawBufferVectorLoad.[[VTY]](i32 303, %dx.types.Handle [[ANHDLRWST]], i32 [[IX1]] + // I1: icmp ne [[VTYPE]] %{{.*}}, zeroinitializer + vector stbElt2 = RwStBuf[ix[1]]; + + // CHECK: [[ANHDLROST:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLROST]] + // CHECK: call %dx.types.ResRet.[[VTY]] @dx.op.rawBufferVectorLoad.[[VTY]](i32 303, %dx.types.Handle [[ANHDLROST]], i32 [[IX0]] + // I1: icmp ne [[VTYPE]] %{{.*}}, zeroinitializer + vector stbElt3 = RoStBuf.Load(ix[0]); + // CHECK: call %dx.types.ResRet.[[VTY]] @dx.op.rawBufferVectorLoad.[[VTY]](i32 303, %dx.types.Handle [[ANHDLROST]], i32 [[IX1]] + // I1: icmp ne [[VTYPE]] %{{.*}}, zeroinitializer + vector stbElt4 = RoStBuf[ix[1]]; + + // I1: zext <[[NUM]] x i1> %{{.*}} to [[VTYPE]] + // CHoCK: all void @dx.op.rawBufferStore.[[TY]](i32 140, %dx.types.Handle [[ANHDLRWST]], i32 [[IX0]] + RwStBuf[ix[0]] = stbElt1 + stbElt2 + stbElt3 + stbElt4; + + // {Append/Consume}StructuredBuffer Tests + // CHECK: [[ANHDLCON:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLCON]] + // CHECK: [[CONIX:%.*]] = call i32 @dx.op.bufferUpdateCounter(i32 70, %dx.types.Handle [[ANHDLCON]], i8 -1) + // CHECK: call %dx.types.ResRet.[[VTY]] @dx.op.rawBufferVectorLoad.[[VTY]](i32 303, %dx.types.Handle [[ANHDLCON]], i32 [[CONIX]] + // I1: icmp ne [[VTYPE]] %{{.*}}, zeroinitializer + vector cnElt = CnStBuf.Consume(); + + // CHECK: [[ANHDLAPP:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLAPP]] + // CHECK: [[APPIX:%.*]] = call i32 @dx.op.bufferUpdateCounter(i32 70, %dx.types.Handle [[ANHDLAPP]], i8 1) + // I1: zext <[[NUM]] x i1> %{{.*}} to [[VTYPE]] + // CHoCK: all void @dx.op.rawBufferStore.[[TY]](i32 140, %dx.types.Handle [[ANHDLAPP]], i32 [[APPIX]] + ApStBuf.Append(cnElt); + + // TypedBuffer Tests + // CHECK: [[ANHDLRWTY:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLRWTY]] + // CHECK: call %dx.types.ResRet.[[TY]] @dx.op.bufferLoad.[[TY]](i32 68, %dx.types.Handle [[ANHDLRWTY]], i32 [[IX0]] + // F64: call double @dx.op.makeDouble.f64(i32 101 + // I64: zext i32 %{{.*}} to i64 + // I64: zext i32 %{{.*}} to i64 + // I64: shl nuw i64 + // I64: or i64 + // I1: icmp ne [[VTYPE]] %{{.*}}, zeroinitializer + vector typElt1 = RwTyBuf.Load(ix[0]); + // CHECK: call %dx.types.ResRet.[[TY]] @dx.op.bufferLoad.[[TY]](i32 68, %dx.types.Handle [[ANHDLRWTY]], i32 [[IX1]] + // F64: call double @dx.op.makeDouble.f64(i32 101 + // I64: zext i32 %{{.*}} to i64 + // I64: zext i32 %{{.*}} to i64 + // I64: shl nuw i64 + // I64: or i64 + // I1: icmp ne [[VTYPE]] %{{.*}}, zeroinitializer + vector typElt2 = RwTyBuf[ix[1]]; + // CHECK: [[ANHDLROTY:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLROTY]] + // CHECK: call %dx.types.ResRet.[[TY]] @dx.op.bufferLoad.[[TY]](i32 68, %dx.types.Handle [[ANHDLROTY]], i32 [[IX0]] + // F64: call double @dx.op.makeDouble.f64(i32 101 + // I64: zext i32 %{{.*}} to i64 + // I64: zext i32 %{{.*}} to i64 + // I64: shl nuw i64 + // I64: or i64 + // I1: icmp ne [[VTYPE]] %{{.*}}, zeroinitializer + vector typElt3 = RoTyBuf.Load(ix[0]); + // CHECK: call %dx.types.ResRet.[[TY]] @dx.op.bufferLoad.[[TY]](i32 68, %dx.types.Handle [[ANHDLROTY]], i32 [[IX1]] + // F64: call double @dx.op.makeDouble.f64(i32 101 + // I64: zext i32 %{{.*}} to i64 + // I64: zext i32 %{{.*}} to i64 + // I64: shl nuw i64 + // I64: or i64 + // I1: icmp ne [[VTYPE]] %{{.*}}, zeroinitializer + vector typElt4 = RoTyBuf[ix[1]]; + + // F64: call %dx.types.splitdouble @dx.op.splitDouble.f64(i32 102 + // I64: trunc i64 %{{.*}} to i32 + // lshr i64 %{{.*}}, 32 + // I64: trunc i64 %{{.*}} to i32 + // I1: zext <[[NUM]] x i1> %{{.*}} to [[VTYPE]] + // CHECK: all void @dx.op.bufferStore.[[TY]](i32 69, %dx.types.Handle [[ANHDLRWTY]], i32 [[IX0]] + RwTyBuf[ix[0]] = typElt1 + typElt2 + typElt3 + typElt4; +} From faa7dbd8235299b7aa6e5daca45d95bf328942a2 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Fri, 7 Mar 2025 22:40:18 -0700 Subject: [PATCH 28/45] Consolidate buffer store translation Added structured buffer support to TranslateStore and used it for all such lowerings. --- lib/HLSL/HLOperationLower.cpp | 173 +++++++++++++--------------------- 1 file changed, 63 insertions(+), 110 deletions(-) diff --git a/lib/HLSL/HLOperationLower.cpp b/lib/HLSL/HLOperationLower.cpp index d53f41c206..6997abe995 100644 --- a/lib/HLSL/HLOperationLower.cpp +++ b/lib/HLSL/HLOperationLower.cpp @@ -4372,18 +4372,15 @@ void Split64bitValForStore(Type *EltTy, ArrayRef vals, unsigned size, } void TranslateStore(DxilResource::Kind RK, Value *handle, Value *val, - Value *offset, IRBuilder<> &Builder, hlsl::OP *OP, - Value *sampIdx = nullptr) { + Value *Idx, Value *offset, IRBuilder<> &Builder, + hlsl::OP *OP, Value *sampIdx = nullptr) { Type *Ty = val->getType(); - - // This function is no longer used for lowering stores to a - // structured buffer. - DXASSERT_NOMSG(RK != DxilResource::Kind::StructuredBuffer); - OP::OpCode opcode = OP::OpCode::NumOpCodes; + bool isTyped = true; switch (RK) { case DxilResource::Kind::RawBuffer: case DxilResource::Kind::StructuredBuffer: + isTyped = false; opcode = OP::OpCode::RawBufferStore; break; case DxilResource::Kind::TypedBuffer: @@ -4401,10 +4398,6 @@ void TranslateStore(DxilResource::Kind RK, Value *handle, Value *val, break; } - bool isTyped = opcode == OP::OpCode::TextureStore || - opcode == OP::OpCode::TextureStoreSample || - RK == DxilResource::Kind::TypedBuffer; - Type *i32Ty = Builder.getInt32Ty(); Type *i64Ty = Builder.getInt64Ty(); Type *doubleTy = Builder.getDoubleTy(); @@ -4443,38 +4436,42 @@ void TranslateStore(DxilResource::Kind RK, Value *handle, Value *val, storeArgs.emplace_back(opArg); // opcode storeArgs.emplace_back(handle); // resource handle - unsigned offset0Idx = 0; - if (RK == DxilResource::Kind::RawBuffer || - RK == DxilResource::Kind::TypedBuffer) { - // Offset 0 - if (offset->getType()->isVectorTy()) { - Value *scalarOffset = Builder.CreateExtractElement(offset, (uint64_t)0); - storeArgs.emplace_back(scalarOffset); // offset + unsigned OffsetIdx = 0; + if (opcode == OP::OpCode::RawBufferStore || + opcode == OP::OpCode::BufferStore) { + // Append Coord0 (Index) value. + if (Idx->getType()->isVectorTy()) { + Value *ScalarIdx = Builder.CreateExtractElement(Idx, (uint64_t)0); + storeArgs.emplace_back(ScalarIdx); // Coord0 (Index). } else { - storeArgs.emplace_back(offset); // offset + storeArgs.emplace_back(Idx); // Coord0 (Index). } - // Store offset0 for later use - offset0Idx = storeArgs.size() - 1; + // Store OffsetIdx representing the argument that may need to be incremented + // later to load additional chunks of data. + // Only structured buffers can use the offset parameter. + // Others must increment the index. + if (RK == DxilResource::Kind::StructuredBuffer) + OffsetIdx = storeArgs.size(); + else + OffsetIdx = storeArgs.size() - 1; - // Offset 1 - storeArgs.emplace_back(undefI); + // Coord1 (Offset). + // Only relevant when storing more than 4 elements to structured buffers. + storeArgs.emplace_back(offset); } else { // texture store unsigned coordSize = DxilResource::GetNumCoords(RK); // Set x first. - if (offset->getType()->isVectorTy()) - storeArgs.emplace_back(Builder.CreateExtractElement(offset, (uint64_t)0)); + if (Idx->getType()->isVectorTy()) + storeArgs.emplace_back(Builder.CreateExtractElement(Idx, (uint64_t)0)); else - storeArgs.emplace_back(offset); - - // Store offset0 for later use - offset0Idx = storeArgs.size() - 1; + storeArgs.emplace_back(Idx); for (unsigned i = 1; i < 3; i++) { if (i < coordSize) - storeArgs.emplace_back(Builder.CreateExtractElement(offset, i)); + storeArgs.emplace_back(Builder.CreateExtractElement(Idx, i)); else storeArgs.emplace_back(undefI); } @@ -4501,23 +4498,17 @@ void TranslateStore(DxilResource::Kind RK, Value *handle, Value *val, } for (unsigned j = 0; j < storeArgsList.size(); j++) { - - // For second and subsequent store calls, increment the offset0 (i.e. store - // index) + // For second and subsequent store calls, increment the resource-appropriate + // index or offset parameter. if (j > 0) { - // Greater than four-components store is not allowed for - // TypedBuffer and Textures. So greater than four elements - // scenario should only get hit here for RawBuffer. - DXASSERT_NOMSG(RK == DxilResource::Kind::RawBuffer); unsigned EltSize = OP->GetAllocSizeForType(EltTy); - unsigned newOffset = EltSize * MaxStoreElemCount * j; - Value *newOffsetVal = ConstantInt::get(Builder.getInt32Ty(), newOffset); - newOffsetVal = - Builder.CreateAdd(storeArgsList[0][offset0Idx], newOffsetVal); - storeArgsList[j][offset0Idx] = newOffsetVal; + unsigned NewCoord = EltSize * MaxStoreElemCount * j; + Value *NewCoordVal = ConstantInt::get(Builder.getInt32Ty(), NewCoord); + NewCoordVal = Builder.CreateAdd(storeArgsList[0][OffsetIdx], NewCoordVal); + storeArgsList[j][OffsetIdx] = NewCoordVal; } - // values + // Set value parameters. uint8_t mask = 0; if (Ty->isVectorTy()) { unsigned vecSize = @@ -4613,7 +4604,8 @@ Value *TranslateResourceStore(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, Value *val = CI->getArgOperand(HLOperandIndex::kStoreValOpIdx); Value *offset = CI->getArgOperand(HLOperandIndex::kStoreOffsetOpIdx); - TranslateStore(RK, handle, val, offset, Builder, hlslOP); + Value *UndefI = UndefValue::get(Builder.getInt32Ty()); + TranslateStore(RK, handle, val, offset, UndefI, Builder, hlslOP); return nullptr; } @@ -7990,40 +7982,13 @@ Value *TranslateStructBufMatLd(CallInst *CI, IRBuilder<> &Builder, void TranslateStructBufMatSt(Type *matType, IRBuilder<> &Builder, Value *handle, hlsl::OP *OP, Value *bufIdx, Value *baseOffset, Value *val, const DataLayout &DL) { +#ifndef NDEBUG HLMatrixType MatTy = HLMatrixType::cast(matType); - Type *EltTy = MatTy.getElementTypeForMem(); - - val = MatTy.emitLoweredRegToMem(val, Builder); - - unsigned EltSize = DL.getTypeAllocSize(EltTy); - Constant *Alignment = OP->GetI32Const(EltSize); - Value *offset = baseOffset; - if (baseOffset == nullptr) - offset = OP->GetU32Const(0); - - unsigned matSize = MatTy.getNumElements(); - Value *undefElt = UndefValue::get(EltTy); - - unsigned storeSize = matSize; - if (matSize % 4) { - storeSize = matSize + 4 - (matSize & 3); - } - std::vector elts(storeSize, undefElt); - for (unsigned i = 0; i < matSize; i++) - elts[i] = Builder.CreateExtractElement(val, i); - - for (unsigned i = 0; i < matSize; i += 4) { - uint8_t mask = 0; - for (unsigned j = 0; j < 4 && (i + j) < matSize; j++) { - if (elts[i + j] != undefElt) - mask |= (1 << j); - } - GenerateStructBufSt(handle, bufIdx, offset, EltTy, OP, Builder, - {elts[i], elts[i + 1], elts[i + 2], elts[i + 3]}, mask, - Alignment); - // Update offset by 4*4bytes. - offset = Builder.CreateAdd(offset, OP->GetU32Const(4 * EltSize)); - } + DXASSERT(MatTy.getLoweredVectorType(false /*MemRepr*/) == val->getType(), + "helper type should match vectorized matrix"); +#endif + TranslateStore(DxilResource::Kind::StructuredBuffer, handle, val, bufIdx, + baseOffset, Builder, OP); } void TranslateStructBufMatLdSt(CallInst *CI, Value *handle, HLResource::Kind RK, @@ -8168,6 +8133,9 @@ void TranslateStructBufMatSubscript(CallInst *CI, Value *handle, GEP->eraseFromParent(); } else if (StoreInst *stUser = dyn_cast(subsUser)) { + // Store elements of matrix in a struct. Needs to be done one scalar at a + // time even for vectors in the case that matrix orientation spreads the + // indexed scalars throughout the matrix vector. IRBuilder<> stBuilder(stUser); Value *Val = stUser->getValueOperand(); if (Val->getType()->isVectorTy()) { @@ -8191,6 +8159,9 @@ void TranslateStructBufMatSubscript(CallInst *CI, Value *handle, LoadInst *ldUser = cast(subsUser); IRBuilder<> ldBuilder(ldUser); Value *ldData = UndefValue::get(resultType); + // Load elements of matrix in a struct. Needs to be done one scalar at a + // time even for vectors in the case that matrix orientation spreads the + // indexed scalars throughout the matrix vector. if (resultType->isVectorTy()) { for (unsigned i = 0; i < resultSize; i++) { Value *ResultElt; @@ -8329,33 +8300,12 @@ void TranslateStructBufSubscriptUser(Instruction *user, Value *handle, TranslateBufLoad(helper, ResKind, Builder, OP, DL); LdInst->eraseFromParent(); - } else if (StoreInst *stInst = dyn_cast(user)) { + } else if (StoreInst *StInst = dyn_cast(user)) { // Store of scalar/vector within a struct or structured raw store. - Type *Ty = stInst->getValueOperand()->getType(); - Type *pOverloadTy = Ty->getScalarType(); - Value *offset = baseOffset; - - Value *val = stInst->getValueOperand(); - Value *undefVal = llvm::UndefValue::get(pOverloadTy); - Value *vals[] = {undefVal, undefVal, undefVal, undefVal}; - uint8_t mask = 0; - if (Ty->isVectorTy()) { - unsigned vectorNumElements = Ty->getVectorNumElements(); - DXASSERT(vectorNumElements <= 4, "up to 4 elements in vector"); - assert(vectorNumElements <= 4); - for (unsigned i = 0; i < vectorNumElements; i++) { - vals[i] = Builder.CreateExtractElement(val, i); - mask |= (1 << i); - } - } else { - vals[0] = val; - mask = DXIL::kCompMask_X; - } - Constant *alignment = - OP->GetI32Const(DL.getTypeAllocSize(Ty->getScalarType())); - GenerateStructBufSt(handle, bufIdx, offset, pOverloadTy, OP, Builder, vals, - mask, alignment); - stInst->eraseFromParent(); + Value *val = StInst->getValueOperand(); + TranslateStore(DxilResource::Kind::StructuredBuffer, handle, val, bufIdx, + baseOffset, Builder, OP); + StInst->eraseFromParent(); } else if (BitCastInst *BCI = dyn_cast(user)) { // Recurse users for (auto U = BCI->user_begin(); U != BCI->user_end();) { @@ -8501,14 +8451,15 @@ void TranslateTypedBufferSubscript(CallInst *CI, HLOperationLowerHelper &helper, User *user = *(It++); Instruction *I = cast(user); IRBuilder<> Builder(I); + Value *UndefI = UndefValue::get(Builder.getInt32Ty()); if (LoadInst *ldInst = dyn_cast(user)) { TranslateTypedBufSubscript(CI, RK, RC, handle, ldInst, Builder, hlslOP, helper.dataLayout); } else if (StoreInst *stInst = dyn_cast(user)) { Value *val = stInst->getValueOperand(); TranslateStore(RK, handle, val, - CI->getArgOperand(HLOperandIndex::kStoreOffsetOpIdx), - Builder, hlslOP); + CI->getArgOperand(HLOperandIndex::kSubscriptIndexOpIdx), + UndefI, Builder, hlslOP); // delete the st stInst->eraseFromParent(); } else if (GetElementPtrInst *GEP = dyn_cast(user)) { @@ -8533,9 +8484,10 @@ void TranslateTypedBufferSubscript(CallInst *CI, HLOperationLowerHelper &helper, // Generate St. // Reset insert point, UpdateVectorElt may move SI to different block. StBuilder.SetInsertPoint(SI); - TranslateStore(RK, handle, ldVal, - CI->getArgOperand(HLOperandIndex::kStoreOffsetOpIdx), - StBuilder, hlslOP); + TranslateStore( + RK, handle, ldVal, + CI->getArgOperand(HLOperandIndex::kSubscriptIndexOpIdx), UndefI, + StBuilder, hlslOP); SI->eraseFromParent(); continue; } @@ -8725,9 +8677,10 @@ void TranslateHLSubscript(CallInst *CI, HLSubscriptOpcode opcode, } else { StoreInst *stInst = cast(*U); Value *val = stInst->getValueOperand(); + Value *UndefI = UndefValue::get(Builder.getInt32Ty()); TranslateStore(RK, handle, val, - CI->getArgOperand(HLOperandIndex::kStoreOffsetOpIdx), - Builder, hlslOP, mipLevel); + CI->getArgOperand(HLOperandIndex::kSubscriptIndexOpIdx), + UndefI, Builder, hlslOP, mipLevel); stInst->eraseFromParent(); } Translated = true; From 35e39f49da17d7d5c89d553fe981c322c9ddc8c8 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Mon, 2 Dec 2024 22:31:31 -1000 Subject: [PATCH 29/45] actually allow the given ops to take vectors add vector overload type and apply to the relevant builtins for 6.9, don't lower vectors for exp lowering. ugly fix for opcode reordering note that still need to clean up loading from BABuffers too --- lib/DXIL/DxilOperations.cpp | 22 +++++++++++----------- utils/hct/hctdb.py | 9 ++++++--- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/lib/DXIL/DxilOperations.cpp b/lib/DXIL/DxilOperations.cpp index 5e92d58999..778130e523 100644 --- a/lib/DXIL/DxilOperations.cpp +++ b/lib/DXIL/DxilOperations.cpp @@ -208,7 +208,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false, false}, + false, true}, Attribute::ReadNone, }, { @@ -235,7 +235,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false, false}, + false, true}, Attribute::ReadNone, }, { @@ -244,7 +244,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false, false}, + false, true}, Attribute::ReadNone, }, { @@ -262,7 +262,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Unary, "unary", {false, true, true, false, false, false, false, false, false, false, - false, false}, + false, true}, Attribute::ReadNone, }, { @@ -385,7 +385,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Binary, "binary", {false, true, true, true, false, false, false, false, false, false, - false, false}, + false, true}, Attribute::ReadNone, }, { @@ -394,7 +394,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Binary, "binary", {false, true, true, true, false, false, false, false, false, false, - false, false}, + false, true}, Attribute::ReadNone, }, @@ -406,7 +406,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Binary, "binary", {false, false, false, false, false, false, true, true, true, false, - false, false}, + false, true}, Attribute::ReadNone, }, { @@ -415,7 +415,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Binary, "binary", {false, false, false, false, false, false, true, true, true, false, - false, false}, + false, true}, Attribute::ReadNone, }, @@ -427,7 +427,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Binary, "binary", {false, false, false, false, false, false, true, true, true, false, - false, false}, + false, true}, Attribute::ReadNone, }, { @@ -436,7 +436,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Binary, "binary", {false, false, false, false, false, false, true, true, true, false, - false, false}, + false, true}, Attribute::ReadNone, }, @@ -511,7 +511,7 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { OCC::Tertiary, "tertiary", {false, false, false, true, false, false, false, false, false, false, - false, false}, + false, true}, Attribute::ReadNone, }, diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 9bafaabea3..9d4eb87f2d 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -1443,7 +1443,7 @@ def UFI(name, **mappings): next_op_idx, "Binary", "returns the " + i + " of the input values", - "hfd", + "hfdt", "rn", [ db_dxil_param(0, "$o", "", "operation result"), @@ -1461,7 +1461,7 @@ def UFI(name, **mappings): next_op_idx, "Binary", "returns the " + i + " of the input values", - "wil", + "wilt", "rn", [ db_dxil_param(0, "$o", "", "operation result"), @@ -1533,7 +1533,7 @@ def UFI(name, **mappings): next_op_idx, "Tertiary", "performs a fused multiply add (FMA) of the form a * b + c", - "d", + "dt", "rn", [ db_dxil_param( @@ -5677,6 +5677,9 @@ def UFI(name, **mappings): ), "all derivatives are marked as requiring gradients" self.name_idx[i].is_deriv = True + for i in "Atan,Htan,Exp,Log".split(","): + self.name_idx[i].oload_types = "hft" + # TODO - some arguments are required to be immediate constants in DXIL, eg resource kinds; add this information # consider - report instructions that are overloaded on a single type, then turn them into non-overloaded version of that type self.verify_dense( From 2051eb528db8c23c96f3af81a4e90770d0b1301f Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Mon, 2 Dec 2024 23:22:39 -1000 Subject: [PATCH 30/45] get min/max/clamp working --- include/dxc/DXIL/DxilOperations.h | 1 - lib/HLSL/HLOperationLower.cpp | 168 ++++++++++++++++++++++-------- 2 files changed, 127 insertions(+), 42 deletions(-) diff --git a/include/dxc/DXIL/DxilOperations.h b/include/dxc/DXIL/DxilOperations.h index a9621d0e51..3a869d3e62 100644 --- a/include/dxc/DXIL/DxilOperations.h +++ b/include/dxc/DXIL/DxilOperations.h @@ -63,7 +63,6 @@ class OP { bool IsDxilOpUsed(OpCode opcode) const; void RemoveFunction(llvm::Function *F); llvm::LLVMContext &GetCtx() { return m_Ctx; } - llvm::Module *GetModule() { return m_pModule; } llvm::Type *GetHandleType() const; llvm::Type *GetNodeHandleType() const; llvm::Type *GetNodeRecordHandleType() const; diff --git a/lib/HLSL/HLOperationLower.cpp b/lib/HLSL/HLOperationLower.cpp index 6997abe995..7386025b2e 100644 --- a/lib/HLSL/HLOperationLower.cpp +++ b/lib/HLSL/HLOperationLower.cpp @@ -481,26 +481,44 @@ Value *TrivialDxilOperation(OP::OpCode opcode, ArrayRef refArgs, return TrivialDxilOperation(opcode, refArgs, Ty, Inst->getType(), hlslOP, B); } -Value *TrivialDxilVectorOperation(OP::OpCode opcode, Value *src, - OP *hlslOP, IRBuilder<> &Builder) { - - Type *Ty = src->getType(); - - Constant *opArg = hlslOP->GetU32Const((unsigned)opcode); - Value *args[] = {opArg, src}; - - Function *dxilFunc = hlslOP->GetOpFunc(opcode, Ty); +Value *TrivialDxilVectorOperation(Function *dxilFunc, OP::OpCode opcode, + ArrayRef refArgs, Type *Ty, + OP *hlslOP, IRBuilder<> &Builder) { if (!Ty->isVoidTy()) { Value *retVal = - Builder.CreateCall(dxilFunc, args, hlslOP->GetOpCodeName(opcode)); + Builder.CreateCall(dxilFunc, refArgs, hlslOP->GetOpCodeName(opcode)); return retVal; } else { // Cannot add name to void. - return Builder.CreateCall(dxilFunc, args); + return Builder.CreateCall(dxilFunc, refArgs); } } + +Value *TrivialDxilVectorUnaryOperationRet(OP::OpCode opcode, Value *src, Type *Ty, + OP *hlslOP, IRBuilder<> &Builder) { + + Constant *opArg = hlslOP->GetU32Const((unsigned)opcode); + Value *args[] = {opArg, src}; + + Function *dxilFunc = hlslOP->GetOpFunc(opcode, Ty); + + return TrivialDxilVectorOperation(dxilFunc, opcode, args, Ty, hlslOP, Builder); +} + +Value *TrivialDxilVectorBinaryOperation(OP::OpCode opcode, Value *src0, Value *src1, + hlsl::OP *hlslOP, IRBuilder<> &Builder) { + Type *Ty = src0->getType(); + + Constant *opArg = hlslOP->GetU32Const((unsigned)opcode); + Value *args[] = {opArg, src0, src1}; + + Function *dxilFunc = hlslOP->GetOpFunc(opcode, Ty); + + return TrivialDxilVectorOperation(dxilFunc, opcode, args, Ty, hlslOP, Builder); +} + Value *TrivialDxilUnaryOperationRet(OP::OpCode opcode, Value *src, Type *RetTy, hlsl::OP *hlslOP, IRBuilder<> &Builder) { Type *Ty = src->getType(); @@ -527,17 +545,26 @@ Value *TrivialDxilBinaryOperation(OP::OpCode opcode, Value *src0, Value *src1, return TrivialDxilOperation(opcode, args, Ty, Ty, hlslOP, Builder); } -Value *TrivialDxilTrinaryOperation(OP::OpCode opcode, Value *src0, Value *src1, - Value *src2, hlsl::OP *hlslOP, - IRBuilder<> &Builder) { - Type *Ty = src0->getType(); - +Value *TrivialDxilTrinaryOperationRet(OP::OpCode opcode, Value *src0, Value *src1, + Value *src2, Type *Ty, hlsl::OP *hlslOP, + IRBuilder<> &Builder) { Constant *opArg = hlslOP->GetU32Const((unsigned)opcode); Value *args[] = {opArg, src0, src1, src2}; return TrivialDxilOperation(opcode, args, Ty, Ty, hlslOP, Builder); } +Value *TrivialDxilVectorTrinaryOperationRet(OP::OpCode opcode, Value *src0, Value *src1, + Value *src2, Type *Ty, hlsl::OP *hlslOP, + IRBuilder<> &Builder) { + Constant *opArg = hlslOP->GetU32Const((unsigned)opcode); + Value *args[] = {opArg, src0, src1, src2}; + + Function *dxilFunc = hlslOP->GetOpFunc(opcode, Ty); + + return TrivialDxilVectorOperation(dxilFunc, opcode, args, Ty, hlslOP, Builder); +} + Value *TrivialUnaryOperation(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, HLOperationLowerHelper &helper, HLObjectOperationLowerHelper *pObjHelper, @@ -550,6 +577,24 @@ Value *TrivialUnaryOperation(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, return retVal; } +Value *TrivialVectorizableUnaryOperation(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, + HLOperationLowerHelper &helper, + HLObjectOperationLowerHelper *pObjHelper, + bool &Translated) { + Value *src0 = CI->getArgOperand(HLOperandIndex::kUnaryOpSrc0Idx); + Type *Ty = CI->getType(); + IRBuilder<> Builder(CI); + hlsl::OP *hlslOP = &helper.hlslOP; + + if (Ty->isVectorTy() && + helper.M.GetShaderModel()->IsSM69Plus()) + return TrivialDxilVectorUnaryOperationRet(opcode, src0, Ty, + hlslOP, Builder); + else + return TrivialDxilUnaryOperationRet(opcode, src0, Ty, + hlslOP, Builder); +} + Value *TrivialBinaryOperation(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, HLOperationLowerHelper &helper, HLObjectOperationLowerHelper *pObjHelper, @@ -564,19 +609,36 @@ Value *TrivialBinaryOperation(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, return binOp; } -Value *TrivialTrinaryOperation(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, - HLOperationLowerHelper &helper, - HLObjectOperationLowerHelper *pObjHelper, - bool &Translated) { +Value *TrivialVectorBinaryOperation(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, + HLOperationLowerHelper &helper, + HLObjectOperationLowerHelper *pObjHelper, + bool &Translated) { hlsl::OP *hlslOP = &helper.hlslOP; + Value *src0 = CI->getArgOperand(HLOperandIndex::kBinaryOpSrc0Idx); + Value *src1 = CI->getArgOperand(HLOperandIndex::kBinaryOpSrc1Idx); + IRBuilder<> Builder(CI); + + Value *binOp = + TrivialDxilVectorBinaryOperation(opcode, src0, src1, hlslOP, Builder); + return binOp; +} + +Value *TranslateFMA(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, + HLOperationLowerHelper &helper, + HLObjectOperationLowerHelper *pObjHelper, + bool &Translated) { + hlsl::OP *hlslOP = &helper.hlslOP; + Type *Ty = CI->getType(); Value *src0 = CI->getArgOperand(HLOperandIndex::kTrinaryOpSrc0Idx); Value *src1 = CI->getArgOperand(HLOperandIndex::kTrinaryOpSrc1Idx); Value *src2 = CI->getArgOperand(HLOperandIndex::kTrinaryOpSrc2Idx); IRBuilder<> Builder(CI); - Value *triOp = - TrivialDxilTrinaryOperation(opcode, src0, src1, src2, hlslOP, Builder); - return triOp; + if (Ty->isVectorTy() && + helper.M.GetShaderModel()->IsSM69Plus()) + return TrivialDxilVectorTrinaryOperationRet(opcode, src0, src1, src2, Ty, hlslOP, Builder); + else + return TrivialDxilTrinaryOperationRet(opcode, src0, src1, src2, Ty, hlslOP, Builder); } Value *TrivialIsSpecialFloat(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, @@ -1916,9 +1978,16 @@ Value *TranslateClamp(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, IRBuilder<> Builder(CI); // min(max(x, minVal), maxVal). - Value *maxXMinVal = + if (Ty->isVectorTy() && + helper.M.GetShaderModel()->IsSM69Plus()) { + Value *maxXMinVal = + TrivialDxilVectorBinaryOperation(maxOp, x, minVal, hlslOP, Builder); + return TrivialDxilVectorBinaryOperation(minOp, maxXMinVal, maxVal, hlslOP, Builder); + } else { + Value *maxXMinVal = TrivialDxilBinaryOperation(maxOp, x, minVal, hlslOP, Builder); - return TrivialDxilBinaryOperation(minOp, maxXMinVal, maxVal, hlslOP, Builder); + return TrivialDxilBinaryOperation(minOp, maxXMinVal, maxVal, hlslOP, Builder); + } } Value *TranslateClip(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, @@ -2231,11 +2300,11 @@ Value *TranslateExp(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, ConstantVector::getSplat(Ty->getVectorNumElements(), log2eConst); } val = Builder.CreateFMul(log2eConst, val); - if (val->getType()->isVectorTy() && - hlslOP->GetModule()->GetHLModule().GetShaderModel()->IsSM69Plus()) - return TrivialDxilVectorOperation(OP::OpCode::Exp, val, hlslOP, Builder); + if (Ty->isVectorTy() && + helper.M.GetShaderModel()->IsSM69Plus()) + return TrivialDxilVectorUnaryOperationRet(OP::OpCode::Exp, val, Ty, hlslOP, Builder); else - return TrivialDxilUnaryOperation(OP::OpCode::Exp, val, hlslOP, Builder); + return TrivialDxilUnaryOperationRet(OP::OpCode::Exp, val, Ty, hlslOP, Builder); } Value *TranslateLog(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, @@ -2250,7 +2319,12 @@ Value *TranslateLog(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, if (Ty != Ty->getScalarType()) { ln2Const = ConstantVector::getSplat(Ty->getVectorNumElements(), ln2Const); } - Value *log = TrivialDxilUnaryOperation(OP::OpCode::Log, val, hlslOP, Builder); + Value *log = nullptr; + if (Ty->isVectorTy() && + helper.M.GetShaderModel()->IsSM69Plus()) + log = TrivialDxilVectorUnaryOperationRet(OP::OpCode::Log, val, Ty, hlslOP, Builder); + else + log = TrivialDxilUnaryOperationRet(OP::OpCode::Log, val, Ty, hlslOP, Builder); return Builder.CreateFMul(ln2Const, log); } @@ -2310,8 +2384,13 @@ Value *TranslateFUIBinary(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, break; } } - return TrivialBinaryOperation(CI, IOP, opcode, helper, pObjHelper, - Translated); + if (CI->getType()->isVectorTy() && + helper.M.GetShaderModel()->IsSM69Plus()) + return TrivialVectorBinaryOperation(CI, IOP, opcode, helper, pObjHelper, + Translated); + else + return TrivialBinaryOperation(CI, IOP, opcode, helper, pObjHelper, + Translated); } Value *TranslateFUITrinary(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, @@ -2328,8 +2407,15 @@ Value *TranslateFUITrinary(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, break; } } - return TrivialTrinaryOperation(CI, IOP, opcode, helper, pObjHelper, - Translated); + + hlsl::OP *hlslOP = &helper.hlslOP; + Type *Ty = CI->getType(); + Value *src0 = CI->getArgOperand(HLOperandIndex::kTrinaryOpSrc0Idx); + Value *src1 = CI->getArgOperand(HLOperandIndex::kTrinaryOpSrc1Idx); + Value *src2 = CI->getArgOperand(HLOperandIndex::kTrinaryOpSrc2Idx); + IRBuilder<> Builder(CI); + + return TrivialDxilTrinaryOperationRet(opcode, src0, src1, src2, Ty, hlslOP, Builder); } Value *TranslateFrexp(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, @@ -2461,8 +2547,8 @@ Value *TranslateIDot(Value *arg0, Value *arg1, unsigned vecSize, for (unsigned iVecElt = 1; iVecElt < vecSize; ++iVecElt) { Elt0 = Builder.CreateExtractElement(arg0, iVecElt); Elt1 = Builder.CreateExtractElement(arg1, iVecElt); - Result = TrivialDxilTrinaryOperation(madOpCode, Elt0, Elt1, Result, hlslOP, - Builder); + Result = TrivialDxilTrinaryOperationRet(madOpCode, Elt0, Elt1, Result, Elt0->getType(), hlslOP, + Builder); } return Result; @@ -2687,8 +2773,8 @@ Value *TranslateMSad4(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, byteSrc = Builder.CreateInsertElement(byteSrc, byteSrcElt, 3); // Msad on vecref and byteSrc. - return TrivialDxilTrinaryOperation(DXIL::OpCode::Msad, vecRef, byteSrc, accum, - hlslOP, Builder); + return TrivialDxilTrinaryOperationRet(DXIL::OpCode::Msad, vecRef, byteSrc, accum, + vecRef->getType(), hlslOP, Builder); } Value *TranslateRCP(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, @@ -6422,7 +6508,7 @@ IntrinsicLower gLowerTable[] = { {IntrinsicOp::IOP_asint16, TranslateBitcast, DXIL::OpCode::NumOpCodes}, {IntrinsicOp::IOP_asuint, TranslateAsUint, DXIL::OpCode::SplitDouble}, {IntrinsicOp::IOP_asuint16, TranslateAsUint, DXIL::OpCode::NumOpCodes}, - {IntrinsicOp::IOP_atan, TrivialUnaryOperation, DXIL::OpCode::Atan}, + {IntrinsicOp::IOP_atan, TrivialVectorizableUnaryOperation, DXIL::OpCode::Atan}, {IntrinsicOp::IOP_atan2, TranslateAtan2, DXIL::OpCode::NumOpCodes}, {IntrinsicOp::IOP_ceil, TrivialUnaryOperation, DXIL::OpCode::Round_pi}, {IntrinsicOp::IOP_clamp, TranslateClamp, DXIL::OpCode::NumOpCodes}, @@ -6465,7 +6551,7 @@ IntrinsicLower gLowerTable[] = { {IntrinsicOp::IOP_firstbitlow, TranslateFirstbitLo, DXIL::OpCode::FirstbitLo}, {IntrinsicOp::IOP_floor, TrivialUnaryOperation, DXIL::OpCode::Round_ni}, - {IntrinsicOp::IOP_fma, TrivialTrinaryOperation, DXIL::OpCode::Fma}, + {IntrinsicOp::IOP_fma, TranslateFMA, DXIL::OpCode::Fma}, {IntrinsicOp::IOP_fmod, TranslateFMod, DXIL::OpCode::NumOpCodes}, {IntrinsicOp::IOP_frac, TrivialUnaryOperation, DXIL::OpCode::Frc}, {IntrinsicOp::IOP_frexp, TranslateFrexp, DXIL::OpCode::NumOpCodes}, @@ -6513,7 +6599,7 @@ IntrinsicLower gLowerTable[] = { {IntrinsicOp::IOP_sqrt, TrivialUnaryOperation, DXIL::OpCode::Sqrt}, {IntrinsicOp::IOP_step, TranslateStep, DXIL::OpCode::NumOpCodes}, {IntrinsicOp::IOP_tan, TrivialUnaryOperation, DXIL::OpCode::Tan}, - {IntrinsicOp::IOP_tanh, TrivialUnaryOperation, DXIL::OpCode::Htan}, + {IntrinsicOp::IOP_tanh, TrivialVectorizableUnaryOperation, DXIL::OpCode::Htan}, {IntrinsicOp::IOP_tex1D, EmptyLower, DXIL::OpCode::NumOpCodes}, {IntrinsicOp::IOP_tex1Dbias, EmptyLower, DXIL::OpCode::NumOpCodes}, {IntrinsicOp::IOP_tex1Dgrad, EmptyLower, DXIL::OpCode::NumOpCodes}, From 82c3b58faf9d4f12b4a5447018ec71af5254755f Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Tue, 3 Dec 2024 11:01:07 -1000 Subject: [PATCH 31/45] initial commit of longvec intrinsics test Preliminary groupshared support Just adds groupshared to the test and performs the switch to CS to allow it. Additionally required storing output to a buffer, which was something that needed testing anyway. keep groupshared as vectors for 6.9 They are no longer represented as inidivual groupshared scalars, but they are still retrived one single element at a time. I'm not sure we have another way to do it just yet. --- .../test/CodeGenDXIL/hlsl/types/longvecs.hlsl | 154 ++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 tools/clang/test/CodeGenDXIL/hlsl/types/longvecs.hlsl diff --git a/tools/clang/test/CodeGenDXIL/hlsl/types/longvecs.hlsl b/tools/clang/test/CodeGenDXIL/hlsl/types/longvecs.hlsl new file mode 100644 index 0000000000..1910e08a25 --- /dev/null +++ b/tools/clang/test/CodeGenDXIL/hlsl/types/longvecs.hlsl @@ -0,0 +1,154 @@ +// RUN: %dxc -Wno-conversion -T cs_6_9 %s | FileCheck %s --check-prefixes=CHECK,F32 +// RUN: %dxc -Wno-conversion -T cs_6_9 -DF64 %s | FileCheck %s --check-prefixes=CHECK,F64 + +RWByteAddressBuffer buf; + +// "TYPE" is the mainly focused test type. +// "UNTYPE" is the other type used for mixed precision testing. +#ifdef F64 +typedef double TYPE; +typedef float UNTYPE; +#else +typedef float TYPE; +typedef double UNTYPE; +#endif + +// Two main test function overloads. One expects matching element types. +// The other uses different types to test ops and overload resolution. +template vector dostuff(vector thing1, vector thing2, vector thing3); +vector dostuff(vector thing1, vector thing2, vector thing3); + +// Just a trick to capture the needed type spellings since the DXC version of FileCheck can't do that explicitly. +// F32-DAG: %dx.types.ResRet.[[TY:v8f32]] = type { [[TYPE:<8 x float>]] +// F32-DAG: %dx.types.ResRet.[[UNTY:v8f64]] = type { [[UNTYPE:<8 x double>]] +// F64-DAG: %dx.types.ResRet.[[TY:v8f64]] = type { [[TYPE:<8 x double>]] +// F64-DAG: %dx.types.ResRet.[[UNTY:v8f32]] = type { [[UNTYPE:<8 x float>]] + +// Verify that groupshared vectors are kept as aggregates +// CHECK: @"\01?gs_vec1@@3V?$vector@{{M|N}}$07@@A" = external addrspace(3) global [[TYPE]] +// CHECK: @"\01?gs_vec2@@3V?$vector@{{M|N}}$07@@A" = external addrspace(3) global [[TYPE]] +// CHECK: @"\01?gs_vec3@@3V?$vector@{{M|N}}$07@@A" = external addrspace(3) global [[TYPE]] +groupshared vector gs_vec1, gs_vec2, gs_vec3; + +[numthreads(8,1,1)] +void main() { + // CHECK: [[buf:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 4107, i32 0 }) ; AnnotateHandle(res,props) resource: RWByteAddressBuffer + + // CHECK: [[vec1_res:%.*]] = call %dx.types.ResRet.[[TY]] @dx.op.rawBufferVectorLoad.[[TY]](i32 303, %dx.types.Handle [[buf]], i32 0 + // CHECK-DAG: [[vec1:%.*]] = extractvalue %dx.types.ResRet.[[TY]] [[vec1_res]], 0 + // F32-DAG: [[vec1_32:%.*]] = extractvalue %dx.types.ResRet.[[TY]] [[vec1_res]], 0 + // F64-DAG: [[vec1_64:%.*]] = extractvalue %dx.types.ResRet.[[TY]] [[vec1_res]], 0 + vector vec1 = buf.Load >(0); + + // CHECK: [[vec2_res:%.*]] = call %dx.types.ResRet.[[TY]] @dx.op.rawBufferVectorLoad.[[TY]](i32 303, %dx.types.Handle [[buf]], i32 60 + // CHECK-DAG: [[vec2:%.*]] = extractvalue %dx.types.ResRet.[[TY]] [[vec2_res]], 0 + // F32-DAG: [[vec2_32:%.*]] = extractvalue %dx.types.ResRet.[[TY]] [[vec2_res]], 0 + // F64-DAG: [[vec2_64:%.*]] = extractvalue %dx.types.ResRet.[[TY]] [[vec2_res]], 0 + vector vec2 = buf.Load >(60); + + // CHECK: [[vec3_res:%.*]] = call %dx.types.ResRet.[[TY]] @dx.op.rawBufferVectorLoad.[[TY]](i32 303, %dx.types.Handle [[buf]], i32 120 + // CHECK-DAG: [[vec3:%.*]] = extractvalue %dx.types.ResRet.[[TY]] [[vec3_res]], 0 + // F64-DAG: [[vec3_64:%.*]] = extractvalue %dx.types.ResRet.[[TY]] [[vec3_res]], 0 + vector vec3 = buf.Load >(120); + + // CHECK: [[unvec_res:%.*]] = call %dx.types.ResRet.[[UNTY]] @dx.op.rawBufferVectorLoad.[[UNTY]](i32 303, %dx.types.Handle [[buf]], i32 180 + // CHECK-DAG: [[unvec:%.*]] = extractvalue %dx.types.ResRet.[[UNTY]] [[unvec_res]], 0 + // F32-DAG: [[unvec_64:%.*]] = extractvalue %dx.types.ResRet.[[UNTY]] [[unvec_res]], 0 + // F64-DAG: [[unvec_32:%.*]] = extractvalue %dx.types.ResRet.[[UNTY]] [[unvec_res]], 0 + vector unvec = buf.Load >(180); + + vec1 = dostuff(vec1, vec2, vec3); + + // Test mixed type operations + vec2 = dostuff(vec2, unvec, vec3); + + gs_vec2 = dostuff(gs_vec1, gs_vec2, gs_vec3); + + // mix groupshared and non + //vec1 = dostuff(vec1, gs_vec2, vec3); + + buf.Store >(240, vec1 * vec2 - vec3 * gs_vec1 + gs_vec2 / gs_vec3); +} + +// Test the required ops on long vectors and confirm correct lowering. +template +vector dostuff(vector thing1, vector thing2, vector thing3) { + vector res = 0; + + // CHECK: call [[TYPE]] @dx.op.binary.[[TY]](i32 36, [[TYPE]] [[vec1]], [[TYPE]] [[vec2]]) ; FMin(a,b) + res += min(thing1, thing2); + // CHECK: call [[TYPE]] @dx.op.binary.[[TY]](i32 35, [[TYPE]] [[vec1]], [[TYPE]] [[vec3]]) ; FMax(a,b) + res += max(thing1, thing3); + + // CHECK: [[tmp:%.*]] = call [[TYPE]] @dx.op.binary.[[TY]](i32 35, [[TYPE]] [[vec1]], [[TYPE]] [[vec2]]) ; FMax(a,b) + // CHECK: call [[TYPE]] @dx.op.binary.[[TY]](i32 36, [[TYPE]] [[tmp]], [[TYPE]] [[vec3]]) ; FMin(a,b) + res += clamp(thing1, thing2, thing3); + + // F32: [[vec3_64:%.*]] = fpext <8 x float> [[vec3]] to <8 x double> + // F32: [[vec2_64:%.*]] = fpext <8 x float> [[vec2]] to <8 x double> + // F32: [[vec1_64:%.*]] = fpext <8 x float> [[vec1]] to <8 x double> + // CHECK: call <8 x double> @dx.op.tertiary.v8f64(i32 47, <8 x double> [[vec1_64]], <8 x double> [[vec2_64]], <8 x double> [[vec3_64]]) ; Fma(a,b,c) + res += (vector)fma((vector)thing1, (vector)(thing2), (vector)thing3); + + // Even in the double test, these will be downconverted because these builtins only take floats. + // F64: [[vec2_32:%.*]] = fptrunc <8 x double> [[vec2]] to <8 x float> + // F64: [[vec1_32:%.*]] = fptrunc <8 x double> [[vec1]] to <8 x float> + + // CHECK: [[tmp:%.*]] = fcmp fast olt <8 x float> [[vec2_32]], [[vec1_32]] + // CHECK: select <8 x i1> [[tmp]], [[TYPE]] zeroinitializer, [[TYPE]] + res += step(thing1, thing2); + + // CHECK: [[tmp:%.*]] = fmul fast <8 x float> [[vec1_32]], @dx.op.unary.v8f32(i32 21, <8 x float> [[tmp]]) ; Exp(value) + res += exp(thing1); + + // CHECK: [[tmp:%.*]] = call <8 x float> @dx.op.unary.v8f32(i32 23, <8 x float> [[vec1_32]]) ; Log(value) + // CHECK: fmul fast <8 x float> [[tmp]], @dx.op.unary.v8f32(i32 20, <8 x float> [[vec1_32]]) ; Htan(value) + res += tanh(thing1); + // CHECK: call <8 x float> @dx.op.unary.v8f32(i32 17, <8 x float> [[vec1_32]]) ; Atan(value) + res += atan(thing1); + + return res; +} + +// A mixed-type overload to test overload resolution and mingle different vector element types in ops +vector dostuff(vector thing1, vector thing2, vector thing3) { + vector res = 0; + + // F64: [[unvec_64:%.*]] = fpext <8 x float> [[unvec]] to <8 x double> + // CHECK: call <8 x double> @dx.op.binary.v8f64(i32 36, <8 x double> [[vec2_64]], <8 x double> [[unvec_64]]) ; FMin(a,b) + res += min(thing1, thing2); + + // CHECK: call [[TYPE]] @dx.op.binary.[[TY]](i32 35, [[TYPE]] [[vec2]], [[TYPE]] [[vec3]]) ; FMax(a,b) + res += max(thing1, thing3); + + // CHECK: [[tmp:%.*]] = call <8 x double> @dx.op.binary.v8f64(i32 35, <8 x double> [[vec2_64]], <8 x double> [[unvec_64]]) ; FMax(a,b) + // CHECK: call <8 x double> @dx.op.binary.v8f64(i32 36, <8 x double> [[tmp]], <8 x double> [[vec3_64]]) ; FMin(a,b) + res += clamp(thing1, thing2, thing3); + + // CHECK: call <8 x double> @dx.op.tertiary.v8f64(i32 47, <8 x double> [[vec2_64]], <8 x double> [[unvec_64]], <8 x double> [[vec3_64]]) ; Fma(a,b,c) + res += (vector)fma((vector)thing1, (vector)(thing2), (vector)thing3); + + // F32: [[unvec_32:%.*]] = fptrunc <8 x double> [[unvec]] to <8 x float> + // CHECK: [[tmp:%.*]] = fcmp fast olt <8 x float> [[unvec_32]], [[vec2_32]] + // CHECK: select <8 x i1> [[tmp]], [[TYPE]] zeroinitializer, [[TYPE]] + res += step(thing1, thing2); + + // CHECK: [[tmp:%.*]] = fmul fast <8 x float> [[vec2_32]], @dx.op.unary.v8f32(i32 21, <8 x float> [[tmp]]) ; Exp(value) + res += exp(thing1); + + // CHECK: [[tmp:%.*]] = call <8 x float> @dx.op.unary.v8f32(i32 23, <8 x float> [[vec2_32]]) ; Log(value) + // CHECK: fmul fast <8 x float> [[tmp]], @dx.op.unary.v8f32(i32 20, <8 x float> [[vec2_32]]) ; Htan(value) + res += tanh(thing1); + // CHECK: call <8 x float> @dx.op.unary.v8f32(i32 17, <8 x float> [[vec2_32]]) ; Atan(value) + res += atan(thing1); + + return res; +} From a41e0a69db6fd072ffe8f1c811bf3dadcc2ab8fe Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Wed, 18 Dec 2024 00:24:03 -0700 Subject: [PATCH 32/45] Disallow swizzles on long vectors --- tools/clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 ++ tools/clang/lib/Sema/SemaHLSL.cpp | 4 ++++ .../test/SemaHLSL/hlsl/types/invalid-longvec-swizzle.hlsl | 7 +++++++ 3 files changed, 13 insertions(+) create mode 100644 tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-swizzle.hlsl diff --git a/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td b/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td index 9be040b8a0..d4ebb2ce21 100644 --- a/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -7549,6 +7549,8 @@ def err_hlsl_vector_element_index_out_of_bounds: Error< "vector element index '%0' is out of bounds">; def err_hlsl_vector_member_too_many_positions: Error< "more than four positions are referenced in '%0'">; +def err_hlsl_vector_member_on_long_vector: Error< + "Invalid swizzle '%0' on vector of over 4 elements.">; def err_hlsl_missing_type_specifier : Error< // Patterened after err_missing_type_specifier "HLSL requires a type specifier for all declarations">; def err_hlsl_multiple_concrete_bases : Error< diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index 6356d83440..146a8397be 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -8611,6 +8611,10 @@ ExprResult HLSLExternalSource::LookupVectorMemberExprForHLSL( llvm_unreachable("Unknown VectorMemberAccessError value"); } + + if (colCount > 4) + msg = diag::err_hlsl_vector_member_on_long_vector; + if (msg != 0) { m_sema->Diag(MemberLoc, msg) << memberText; diff --git a/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-swizzle.hlsl b/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-swizzle.hlsl new file mode 100644 index 0000000000..472a192677 --- /dev/null +++ b/tools/clang/test/SemaHLSL/hlsl/types/invalid-longvec-swizzle.hlsl @@ -0,0 +1,7 @@ +// RUN: %dxc -Tlib_6_9 -verify %s + +export +vector doit(vector vec5) { + vec5.x = 1; // expected-error {{Invalid swizzle 'x' on vector of over 4 elements.}} + return vec5.xyw; // expected-error {{Invalid swizzle 'xyw' on vector of over 4 elements.}} +} From f88e01023316bf895736f0788c73921e605db6cf Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Mon, 6 Jan 2025 03:17:57 -0700 Subject: [PATCH 33/45] Make dot product work for long vecs Support dot product on long vecs by expanding the inrinsic into mul/mad ops like is done with integer dot products --- lib/HLSL/HLOperationLower.cpp | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/lib/HLSL/HLOperationLower.cpp b/lib/HLSL/HLOperationLower.cpp index 7386025b2e..3878a0856b 100644 --- a/lib/HLSL/HLOperationLower.cpp +++ b/lib/HLSL/HLOperationLower.cpp @@ -817,6 +817,12 @@ bool CanUseFxcMulOnlyPatternForPow(IRBuilder<> &Builder, Value *x, Value *pow, } } + // Only apply on aggregates of 16 or fewer elements, + // representing the max 4x4 matrix size. + Type *xTy = x->getType(); + if (xTy->isVectorTy() && xTy->getVectorNumElements() > 16) + return false; + APFloat powAPF = isa(pow) ? cast(pow)->getElementAsAPFloat(0) : // should be a splat value @@ -2537,16 +2543,20 @@ Value *TrivialDotOperation(OP::OpCode opcode, Value *src0, Value *src1, return dotOP; } -Value *TranslateIDot(Value *arg0, Value *arg1, unsigned vecSize, - hlsl::OP *hlslOP, IRBuilder<> &Builder, - bool Unsigned = false) { +// Instead of using a DXIL intrinsic, implement a dot product operation using +// multiply and add operations. Used for integer dots and long vectors. +Value *ExpandDot(Value *arg0, Value *arg1, unsigned vecSize, + hlsl::OP *hlslOP, IRBuilder<> &Builder, + bool Unsigned = false) { auto madOpCode = Unsigned ? DXIL::OpCode::UMad : DXIL::OpCode::IMad; + if (arg0->getType()->getScalarType()->isFloatingPointTy()) + madOpCode = DXIL::OpCode::FMad; Value *Elt0 = Builder.CreateExtractElement(arg0, (uint64_t)0); Value *Elt1 = Builder.CreateExtractElement(arg1, (uint64_t)0); Value *Result = Builder.CreateMul(Elt0, Elt1); - for (unsigned iVecElt = 1; iVecElt < vecSize; ++iVecElt) { - Elt0 = Builder.CreateExtractElement(arg0, iVecElt); - Elt1 = Builder.CreateExtractElement(arg1, iVecElt); + for (unsigned Elt = 1; Elt < vecSize; ++Elt) { + Elt0 = Builder.CreateExtractElement(arg0, Elt); + Elt1 = Builder.CreateExtractElement(arg1, Elt); Result = TrivialDxilTrinaryOperationRet(madOpCode, Elt0, Elt1, Result, Elt0->getType(), hlslOP, Builder); } @@ -2586,10 +2596,10 @@ Value *TranslateDot(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, unsigned vecSize = Ty->getVectorNumElements(); Value *arg1 = CI->getArgOperand(HLOperandIndex::kBinaryOpSrc1Idx); IRBuilder<> Builder(CI); - if (Ty->getScalarType()->isFloatingPointTy()) { + if (Ty->getScalarType()->isFloatingPointTy() && Ty->getVectorNumElements() <= 4) { return TranslateFDot(arg0, arg1, vecSize, hlslOP, Builder); } else { - return TranslateIDot(arg0, arg1, vecSize, hlslOP, Builder, + return ExpandDot(arg0, arg1, vecSize, hlslOP, Builder, IOP == IntrinsicOp::IOP_udot); } } @@ -3156,7 +3166,7 @@ Value *TranslateMul(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, if (arg0Ty->getScalarType()->isFloatingPointTy()) { return TranslateFDot(arg0, arg1, vecSize, hlslOP, Builder); } else { - return TranslateIDot(arg0, arg1, vecSize, hlslOP, Builder, + return ExpandDot(arg0, arg1, vecSize, hlslOP, Builder, IOP == IntrinsicOp::IOP_umul); } } else { From 13ae80fac48d19e8517f88ba212c79eb0c55b6a7 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Mon, 13 Jan 2025 04:33:52 -0700 Subject: [PATCH 34/45] Allow vectors on or/and intrinsics Since the or() and and() intrinsics did their own scalarization, the or/and operators would never be applied to full vectors. This leaves the scalarization for the scalarization pass, which will skip it for 6.9 --- lib/HLSL/HLOperationLower.cpp | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/lib/HLSL/HLOperationLower.cpp b/lib/HLSL/HLOperationLower.cpp index 3878a0856b..0dc9574cd2 100644 --- a/lib/HLSL/HLOperationLower.cpp +++ b/lib/HLSL/HLOperationLower.cpp @@ -6206,20 +6206,8 @@ Value *TranslateAnd(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, bool &Translated) { Value *x = CI->getArgOperand(HLOperandIndex::kBinaryOpSrc0Idx); Value *y = CI->getArgOperand(HLOperandIndex::kBinaryOpSrc1Idx); - Type *Ty = CI->getType(); - Type *EltTy = Ty->getScalarType(); IRBuilder<> Builder(CI); - if (Ty != EltTy) { - Value *Result = UndefValue::get(Ty); - for (unsigned i = 0; i < Ty->getVectorNumElements(); i++) { - Value *EltX = Builder.CreateExtractElement(x, i); - Value *EltY = Builder.CreateExtractElement(y, i); - Value *tmp = Builder.CreateAnd(EltX, EltY); - Result = Builder.CreateInsertElement(Result, tmp, i); - } - return Result; - } return Builder.CreateAnd(x, y); } Value *TranslateOr(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, @@ -6227,20 +6215,8 @@ Value *TranslateOr(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, HLObjectOperationLowerHelper *pObjHelper, bool &Translated) { Value *x = CI->getArgOperand(HLOperandIndex::kBinaryOpSrc0Idx); Value *y = CI->getArgOperand(HLOperandIndex::kBinaryOpSrc1Idx); - Type *Ty = CI->getType(); - Type *EltTy = Ty->getScalarType(); IRBuilder<> Builder(CI); - if (Ty != EltTy) { - Value *Result = UndefValue::get(Ty); - for (unsigned i = 0; i < Ty->getVectorNumElements(); i++) { - Value *EltX = Builder.CreateExtractElement(x, i); - Value *EltY = Builder.CreateExtractElement(y, i); - Value *tmp = Builder.CreateOr(EltX, EltY); - Result = Builder.CreateInsertElement(Result, tmp, i); - } - return Result; - } return Builder.CreateOr(x, y); } Value *TranslateSelect(CallInst *CI, IntrinsicOp IOP, OP::OpCode opcode, From e1aca978b11e9dab5d9228cb5853fa29fadc3905 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Mon, 10 Mar 2025 02:44:56 -0600 Subject: [PATCH 35/45] Enable native vector rawbuffer stores --- include/dxc/DXIL/DxilOperations.h | 1 + lib/HLSL/HLOperationLower.cpp | 17 +++++++++++++++-- .../intrinsics/buffer-load-stores-sm69.hlsl | 6 +++--- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/include/dxc/DXIL/DxilOperations.h b/include/dxc/DXIL/DxilOperations.h index 3a869d3e62..a9621d0e51 100644 --- a/include/dxc/DXIL/DxilOperations.h +++ b/include/dxc/DXIL/DxilOperations.h @@ -63,6 +63,7 @@ class OP { bool IsDxilOpUsed(OpCode opcode) const; void RemoveFunction(llvm::Function *F); llvm::LLVMContext &GetCtx() { return m_Ctx; } + llvm::Module *GetModule() { return m_pModule; } llvm::Type *GetHandleType() const; llvm::Type *GetNodeHandleType() const; llvm::Type *GetNodeRecordHandleType() const; diff --git a/lib/HLSL/HLOperationLower.cpp b/lib/HLSL/HLOperationLower.cpp index 0dc9574cd2..c8906a1cd2 100644 --- a/lib/HLSL/HLOperationLower.cpp +++ b/lib/HLSL/HLOperationLower.cpp @@ -4478,6 +4478,10 @@ void TranslateStore(DxilResource::Kind RK, Value *handle, Value *val, case DxilResource::Kind::StructuredBuffer: isTyped = false; opcode = OP::OpCode::RawBufferStore; + // Where shader model and type allows, use vector store intrinsic. + if (OP->GetModule()->GetHLModule().GetShaderModel()->IsSM69Plus() && + Ty->isVectorTy() && Ty->getVectorNumElements() > 1) + opcode = OP::OpCode::RawBufferVectorStore; break; case DxilResource::Kind::TypedBuffer: opcode = OP::OpCode::BufferStore; @@ -4520,7 +4524,6 @@ void TranslateStore(DxilResource::Kind RK, Value *handle, Value *val, EltTy = i32Ty; } - Function *F = OP->GetOpFunc(opcode, EltTy); llvm::Constant *opArg = OP->GetU32Const((unsigned)opcode); llvm::Value *undefI = @@ -4534,6 +4537,7 @@ void TranslateStore(DxilResource::Kind RK, Value *handle, Value *val, unsigned OffsetIdx = 0; if (opcode == OP::OpCode::RawBufferStore || + opcode == OP::OpCode::RawBufferVectorStore || opcode == OP::OpCode::BufferStore) { // Append Coord0 (Index) value. if (Idx->getType()->isVectorTy()) { @@ -4553,7 +4557,6 @@ void TranslateStore(DxilResource::Kind RK, Value *handle, Value *val, OffsetIdx = storeArgs.size() - 1; // Coord1 (Offset). - // Only relevant when storing more than 4 elements to structured buffers. storeArgs.emplace_back(offset); } else { // texture store @@ -4574,6 +4577,16 @@ void TranslateStore(DxilResource::Kind RK, Value *handle, Value *val, // TODO: support mip for texture ST } + // RawBufferVectorStore only takes a single value and alignment arguments. + if (opcode == DXIL::OpCode::RawBufferVectorStore) { + storeArgs.emplace_back(val); + storeArgs.emplace_back(Alignment); + Function *F = OP->GetOpFunc(DXIL::OpCode::RawBufferVectorStore, Ty); + Builder.CreateCall(F, storeArgs); + return; + } + Function *F = OP->GetOpFunc(opcode, EltTy); + constexpr unsigned MaxStoreElemCount = 4; const unsigned CompCount = Ty->isVectorTy() ? Ty->getVectorNumElements() : 1; const unsigned StoreInstCount = diff --git a/tools/clang/test/CodeGenDXIL/hlsl/intrinsics/buffer-load-stores-sm69.hlsl b/tools/clang/test/CodeGenDXIL/hlsl/intrinsics/buffer-load-stores-sm69.hlsl index 18bec196e4..724c7a505d 100644 --- a/tools/clang/test/CodeGenDXIL/hlsl/intrinsics/buffer-load-stores-sm69.hlsl +++ b/tools/clang/test/CodeGenDXIL/hlsl/intrinsics/buffer-load-stores-sm69.hlsl @@ -54,7 +54,7 @@ void main(uint ix[2] : IX) { vector babElt2 = RoByBuf.Load< vector >(ix[0]); // I1: zext <[[NUM]] x i1> %{{.*}} to [[VTYPE]] - // CHoCK: all void @dx.op.rawBufferStore.[[TY]](i32 140, %dx.types.Handle [[ANHDLRWBY]], i32 [[IX0]] + // CHECK: all void @dx.op.rawBufferVectorStore.[[VTY]](i32 304, %dx.types.Handle [[ANHDLRWBY]], i32 [[IX0]] RwByBuf.Store< vector >(ix[0], babElt1 + babElt2); // StructuredBuffer Tests @@ -76,7 +76,7 @@ void main(uint ix[2] : IX) { vector stbElt4 = RoStBuf[ix[1]]; // I1: zext <[[NUM]] x i1> %{{.*}} to [[VTYPE]] - // CHoCK: all void @dx.op.rawBufferStore.[[TY]](i32 140, %dx.types.Handle [[ANHDLRWST]], i32 [[IX0]] + // CHECK: all void @dx.op.rawBufferVectorStore.[[VTY]](i32 304, %dx.types.Handle [[ANHDLRWST]], i32 [[IX0]] RwStBuf[ix[0]] = stbElt1 + stbElt2 + stbElt3 + stbElt4; // {Append/Consume}StructuredBuffer Tests @@ -89,7 +89,7 @@ void main(uint ix[2] : IX) { // CHECK: [[ANHDLAPP:%.*]] = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[HDLAPP]] // CHECK: [[APPIX:%.*]] = call i32 @dx.op.bufferUpdateCounter(i32 70, %dx.types.Handle [[ANHDLAPP]], i8 1) // I1: zext <[[NUM]] x i1> %{{.*}} to [[VTYPE]] - // CHoCK: all void @dx.op.rawBufferStore.[[TY]](i32 140, %dx.types.Handle [[ANHDLAPP]], i32 [[APPIX]] + // CHECK: all void @dx.op.rawBufferVectorStore.[[VTY]](i32 304, %dx.types.Handle [[ANHDLAPP]], i32 [[APPIX]] ApStBuf.Append(cnElt); // TypedBuffer Tests From ed52646d7741d9fb83706d31c896ac3891516291 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Thu, 13 Mar 2025 08:58:06 -0600 Subject: [PATCH 36/45] clumsy addition of packed types --- tools/clang/lib/Sema/SemaHLSL.cpp | 20 +++++++++++++------ .../intrinsics/buffer-load-stores-sm69.hlsl | 1 + .../hlsl/types/longvec-operators.hlsl | 1 + 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index 146a8397be..555b0ba44a 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -1018,12 +1018,13 @@ static const ArBasicKind g_UIntCT[] = {AR_BASIC_UINT32, AR_BASIC_LITERAL_INT, // should map to int32, not int16 or int64 static const ArBasicKind g_AnyIntCT[] = { AR_BASIC_INT32, AR_BASIC_INT16, AR_BASIC_UINT32, AR_BASIC_UINT16, - AR_BASIC_INT64, AR_BASIC_UINT64, AR_BASIC_LITERAL_INT, AR_BASIC_UNKNOWN}; + AR_BASIC_INT64, AR_BASIC_UINT64, AR_BASIC_INT8_4PACKED, AR_BASIC_UINT8_4PACKED, + AR_BASIC_LITERAL_INT, AR_BASIC_UNKNOWN}; static const ArBasicKind g_AnyInt32CT[] = { - AR_BASIC_INT32, AR_BASIC_UINT32, AR_BASIC_LITERAL_INT, AR_BASIC_UNKNOWN}; + AR_BASIC_INT32, AR_BASIC_UINT32, AR_BASIC_INT8_4PACKED, AR_BASIC_UINT8_4PACKED, AR_BASIC_LITERAL_INT, AR_BASIC_UNKNOWN}; -static const ArBasicKind g_UIntOnlyCT[] = {AR_BASIC_UINT32, AR_BASIC_UINT64, +static const ArBasicKind g_UIntOnlyCT[] = {AR_BASIC_UINT32, AR_BASIC_UINT64,AR_BASIC_INT8_4PACKED, AR_BASIC_UINT8_4PACKED, AR_BASIC_LITERAL_INT, AR_BASIC_NOCAST, AR_BASIC_UNKNOWN}; @@ -1063,18 +1064,20 @@ static const ArBasicKind g_NumericCT[] = { AR_BASIC_UINT16, AR_BASIC_UINT32, AR_BASIC_MIN12INT, AR_BASIC_MIN16INT, AR_BASIC_MIN16UINT, AR_BASIC_INT64, - AR_BASIC_UINT64, AR_BASIC_UNKNOWN}; + AR_BASIC_UINT64, AR_BASIC_INT8_4PACKED, AR_BASIC_UINT8_4PACKED, AR_BASIC_UNKNOWN}; static const ArBasicKind g_Numeric32CT[] = { AR_BASIC_FLOAT32, AR_BASIC_FLOAT32_PARTIAL_PRECISION, AR_BASIC_LITERAL_FLOAT, AR_BASIC_LITERAL_INT, AR_BASIC_INT32, AR_BASIC_UINT32, +AR_BASIC_INT8_4PACKED, AR_BASIC_UINT8_4PACKED, AR_BASIC_UNKNOWN}; static const ArBasicKind g_Numeric32OnlyCT[] = { AR_BASIC_FLOAT32, AR_BASIC_FLOAT32_PARTIAL_PRECISION, AR_BASIC_LITERAL_FLOAT, AR_BASIC_LITERAL_INT, AR_BASIC_INT32, AR_BASIC_UINT32, +AR_BASIC_INT8_4PACKED, AR_BASIC_UINT8_4PACKED, AR_BASIC_NOCAST, AR_BASIC_UNKNOWN}; static const ArBasicKind g_AnyCT[] = { @@ -1087,6 +1090,7 @@ static const ArBasicKind g_AnyCT[] = { AR_BASIC_MIN12INT, AR_BASIC_MIN16INT, AR_BASIC_MIN16UINT, AR_BASIC_BOOL, AR_BASIC_INT64, AR_BASIC_UINT64, +AR_BASIC_INT8_4PACKED, AR_BASIC_UINT8_4PACKED, AR_BASIC_UNKNOWN}; static const ArBasicKind g_AnySamplerCT[] = { @@ -1150,6 +1154,7 @@ static const ArBasicKind g_Numeric16OnlyCT[] = { AR_BASIC_UNKNOWN}; static const ArBasicKind g_Int32OnlyCT[] = {AR_BASIC_INT32, AR_BASIC_UINT32, +AR_BASIC_INT8_4PACKED, AR_BASIC_UINT8_4PACKED, AR_BASIC_LITERAL_INT, AR_BASIC_NOCAST, AR_BASIC_UNKNOWN}; @@ -1174,10 +1179,13 @@ static const ArBasicKind g_UInt8_4PackedCT[] = { static const ArBasicKind g_AnyInt16Or32CT[] = { AR_BASIC_INT32, AR_BASIC_UINT32, AR_BASIC_INT16, - AR_BASIC_UINT16, AR_BASIC_LITERAL_INT, AR_BASIC_UNKNOWN}; + AR_BASIC_UINT16, +AR_BASIC_INT8_4PACKED, AR_BASIC_UINT8_4PACKED, AR_BASIC_LITERAL_INT, AR_BASIC_UNKNOWN}; static const ArBasicKind g_SInt16Or32OnlyCT[] = { - AR_BASIC_INT32, AR_BASIC_INT16, AR_BASIC_LITERAL_INT, AR_BASIC_NOCAST, + AR_BASIC_INT32, AR_BASIC_INT16, AR_BASIC_LITERAL_INT, +AR_BASIC_INT8_4PACKED, AR_BASIC_UINT8_4PACKED, +AR_BASIC_NOCAST, AR_BASIC_UNKNOWN}; static const ArBasicKind g_ByteAddressBufferCT[] = { diff --git a/tools/clang/test/CodeGenDXIL/hlsl/intrinsics/buffer-load-stores-sm69.hlsl b/tools/clang/test/CodeGenDXIL/hlsl/intrinsics/buffer-load-stores-sm69.hlsl index 724c7a505d..8df8a36cd7 100644 --- a/tools/clang/test/CodeGenDXIL/hlsl/intrinsics/buffer-load-stores-sm69.hlsl +++ b/tools/clang/test/CodeGenDXIL/hlsl/intrinsics/buffer-load-stores-sm69.hlsl @@ -1,5 +1,6 @@ // RUN: %dxc -DTYPE=float -DNUM=4 -T vs_6_9 %s | FileCheck %s // RUN: %dxc -DTYPE=bool -DNUM=4 -T vs_6_9 %s | FileCheck %s --check-prefixes=CHECK,I1 +// RUN: %dxc -DTYPE=uint8_t4_packed -DNUM=4 -T vs_6_9 %s | FileCheck %s --check-prefixes=CHECK // 64-bit types require operation/intrinsic support to convert the values to/from the i32 memory representations. // RUN: %dxc -DTYPE=uint64_t -DNUM=2 -T vs_6_9 %s | FileCheck %s --check-prefixes=CHECK,I64 diff --git a/tools/clang/test/CodeGenDXIL/hlsl/types/longvec-operators.hlsl b/tools/clang/test/CodeGenDXIL/hlsl/types/longvec-operators.hlsl index b617bf15b1..b3285267c9 100644 --- a/tools/clang/test/CodeGenDXIL/hlsl/types/longvec-operators.hlsl +++ b/tools/clang/test/CodeGenDXIL/hlsl/types/longvec-operators.hlsl @@ -19,6 +19,7 @@ // Less exhaustive testing for some other types. // RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=int -DNUM=2 %s | FileCheck %s --check-prefixes=CHECK,NODBL +// RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=uint8_t4_packed -DNUM=4 %s | FileCheck %s --check-prefixes=CHECK,NODBL // RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=uint -DNUM=5 %s | FileCheck %s --check-prefixes=CHECK,NODBL // RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=double -DNUM=3 -DDBL %s | FileCheck %s --check-prefixes=CHECK,DBL // RUN: %dxc -HV 2018 -T lib_6_9 -DTYPE=uint64_t -DNUM=9 %s | FileCheck %s --check-prefixes=CHECK,NODBL From f3ac2715f41f8f6f8d47f9c35c9c88f89e12762d Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Thu, 20 Mar 2025 09:12:34 -0700 Subject: [PATCH 37/45] NFC: Make hlsl::IntrinsicOp enum values stable (#7231) This change makes hlsl::IntrinsicOp enum values stable by: - adding hlsl_intrinsic_opcodes.json to capture assigned indices - adds this to the files generated by hctgen - generation assigns new indices after the last index - hlsl::IntrinsicOp enum values have explicit assignments - removes ENABLE_SPIRV_CODEGEN ifdefs around opcode definitions and lowering table entries to keep these stable whether or not the spirv build setting is enabled. Fixes #7230 --- CMakeLists.txt | 2 + include/dxc/HlslIntrinsicOp.h | 730 +++++++++++++------------- lib/HLSL/HLOperationLower.cpp | 8 +- utils/hct/CMakeLists.txt | 3 + utils/hct/hctdb.py | 35 +- utils/hct/hctdb_instrhelp.py | 39 +- utils/hct/hctgen.py | 10 + utils/hct/hlsl_intrinsic_opcodes.json | 363 +++++++++++++ 8 files changed, 801 insertions(+), 389 deletions(-) create mode 100644 utils/hct/CMakeLists.txt create mode 100644 utils/hct/hlsl_intrinsic_opcodes.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f7db99784..74244c1d58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -686,6 +686,8 @@ add_subdirectory(include/dxc) # really depend on anything else in the build it is safe. list(APPEND LLVM_COMMON_DEPENDS HCTGen) +add_subdirectory(utils/hct) + if(EXISTS "${LLVM_MAIN_SRC_DIR}/external") add_subdirectory(external) # SPIRV change endif() diff --git a/include/dxc/HlslIntrinsicOp.h b/include/dxc/HlslIntrinsicOp.h index fcc9bb11b1..41c72d1a51 100644 --- a/include/dxc/HlslIntrinsicOp.h +++ b/include/dxc/HlslIntrinsicOp.h @@ -5,378 +5,366 @@ #pragma once namespace hlsl { enum class IntrinsicOp { - IOP_AcceptHitAndEndSearch, - IOP_AddUint64, - IOP_AllMemoryBarrier, - IOP_AllMemoryBarrierWithGroupSync, - IOP_AllocateRayQuery, - IOP_Barrier, - IOP_CallShader, - IOP_CheckAccessFullyMapped, - IOP_CreateResourceFromHeap, - IOP_D3DCOLORtoUBYTE4, - IOP_DeviceMemoryBarrier, - IOP_DeviceMemoryBarrierWithGroupSync, - IOP_DispatchMesh, - IOP_DispatchRaysDimensions, - IOP_DispatchRaysIndex, - IOP_EvaluateAttributeAtSample, - IOP_EvaluateAttributeCentroid, - IOP_EvaluateAttributeSnapped, - IOP_GeometryIndex, - IOP_GetAttributeAtVertex, - IOP_GetRemainingRecursionLevels, - IOP_GetRenderTargetSampleCount, - IOP_GetRenderTargetSamplePosition, - IOP_GroupMemoryBarrier, - IOP_GroupMemoryBarrierWithGroupSync, - IOP_HitKind, - IOP_IgnoreHit, - IOP_InstanceID, - IOP_InstanceIndex, - IOP_InterlockedAdd, - IOP_InterlockedAnd, - IOP_InterlockedCompareExchange, - IOP_InterlockedCompareExchangeFloatBitwise, - IOP_InterlockedCompareStore, - IOP_InterlockedCompareStoreFloatBitwise, - IOP_InterlockedExchange, - IOP_InterlockedMax, - IOP_InterlockedMin, - IOP_InterlockedOr, - IOP_InterlockedXor, - IOP_IsHelperLane, - IOP_NonUniformResourceIndex, - IOP_ObjectRayDirection, - IOP_ObjectRayOrigin, - IOP_ObjectToWorld, - IOP_ObjectToWorld3x4, - IOP_ObjectToWorld4x3, - IOP_PrimitiveIndex, - IOP_Process2DQuadTessFactorsAvg, - IOP_Process2DQuadTessFactorsMax, - IOP_Process2DQuadTessFactorsMin, - IOP_ProcessIsolineTessFactors, - IOP_ProcessQuadTessFactorsAvg, - IOP_ProcessQuadTessFactorsMax, - IOP_ProcessQuadTessFactorsMin, - IOP_ProcessTriTessFactorsAvg, - IOP_ProcessTriTessFactorsMax, - IOP_ProcessTriTessFactorsMin, - IOP_QuadAll, - IOP_QuadAny, - IOP_QuadReadAcrossDiagonal, - IOP_QuadReadAcrossX, - IOP_QuadReadAcrossY, - IOP_QuadReadLaneAt, - IOP_RayFlags, - IOP_RayTCurrent, - IOP_RayTMin, - IOP_ReportHit, - IOP_SetMeshOutputCounts, - IOP_TraceRay, - IOP_WaveActiveAllEqual, - IOP_WaveActiveAllTrue, - IOP_WaveActiveAnyTrue, - IOP_WaveActiveBallot, - IOP_WaveActiveBitAnd, - IOP_WaveActiveBitOr, - IOP_WaveActiveBitXor, - IOP_WaveActiveCountBits, - IOP_WaveActiveMax, - IOP_WaveActiveMin, - IOP_WaveActiveProduct, - IOP_WaveActiveSum, - IOP_WaveGetLaneCount, - IOP_WaveGetLaneIndex, - IOP_WaveIsFirstLane, - IOP_WaveMatch, - IOP_WaveMultiPrefixBitAnd, - IOP_WaveMultiPrefixBitOr, - IOP_WaveMultiPrefixBitXor, - IOP_WaveMultiPrefixCountBits, - IOP_WaveMultiPrefixProduct, - IOP_WaveMultiPrefixSum, - IOP_WavePrefixCountBits, - IOP_WavePrefixProduct, - IOP_WavePrefixSum, - IOP_WaveReadLaneAt, - IOP_WaveReadLaneFirst, - IOP_WorldRayDirection, - IOP_WorldRayOrigin, - IOP_WorldToObject, - IOP_WorldToObject3x4, - IOP_WorldToObject4x3, - IOP_abort, - IOP_abs, - IOP_acos, - IOP_all, - IOP_and, - IOP_any, - IOP_asdouble, - IOP_asfloat, - IOP_asfloat16, - IOP_asin, - IOP_asint, - IOP_asint16, - IOP_asuint, - IOP_asuint16, - IOP_atan, - IOP_atan2, - IOP_ceil, - IOP_clamp, - IOP_clip, - IOP_cos, - IOP_cosh, - IOP_countbits, - IOP_cross, - IOP_ddx, - IOP_ddx_coarse, - IOP_ddx_fine, - IOP_ddy, - IOP_ddy_coarse, - IOP_ddy_fine, - IOP_degrees, - IOP_determinant, - IOP_distance, - IOP_dot, - IOP_dot2add, - IOP_dot4add_i8packed, - IOP_dot4add_u8packed, - IOP_dst, - IOP_exp, - IOP_exp2, - IOP_f16tof32, - IOP_f32tof16, - IOP_faceforward, - IOP_firstbithigh, - IOP_firstbitlow, - IOP_floor, - IOP_fma, - IOP_fmod, - IOP_frac, - IOP_frexp, - IOP_fwidth, - IOP_isfinite, - IOP_isinf, - IOP_isnan, - IOP_ldexp, - IOP_length, - IOP_lerp, - IOP_lit, - IOP_log, - IOP_log10, - IOP_log2, - IOP_mad, - IOP_max, - IOP_min, - IOP_modf, - IOP_msad4, - IOP_mul, - IOP_normalize, - IOP_or, - IOP_pack_clamp_s8, - IOP_pack_clamp_u8, - IOP_pack_s8, - IOP_pack_u8, - IOP_pow, - IOP_printf, - IOP_radians, - IOP_rcp, - IOP_reflect, - IOP_refract, - IOP_reversebits, - IOP_round, - IOP_rsqrt, - IOP_saturate, - IOP_select, - IOP_sign, - IOP_sin, - IOP_sincos, - IOP_sinh, - IOP_smoothstep, - IOP_source_mark, - IOP_sqrt, - IOP_step, - IOP_tan, - IOP_tanh, - IOP_tex1D, - IOP_tex1Dbias, - IOP_tex1Dgrad, - IOP_tex1Dlod, - IOP_tex1Dproj, - IOP_tex2D, - IOP_tex2Dbias, - IOP_tex2Dgrad, - IOP_tex2Dlod, - IOP_tex2Dproj, - IOP_tex3D, - IOP_tex3Dbias, - IOP_tex3Dgrad, - IOP_tex3Dlod, - IOP_tex3Dproj, - IOP_texCUBE, - IOP_texCUBEbias, - IOP_texCUBEgrad, - IOP_texCUBElod, - IOP_texCUBEproj, - IOP_transpose, - IOP_trunc, - IOP_unpack_s8s16, - IOP_unpack_s8s32, - IOP_unpack_u8u16, - IOP_unpack_u8u32, -#ifdef ENABLE_SPIRV_CODEGEN - IOP_VkRawBufferLoad, -#endif // ENABLE_SPIRV_CODEGEN -#ifdef ENABLE_SPIRV_CODEGEN - IOP_VkRawBufferStore, -#endif // ENABLE_SPIRV_CODEGEN -#ifdef ENABLE_SPIRV_CODEGEN - IOP_VkReadClock, -#endif // ENABLE_SPIRV_CODEGEN -#ifdef ENABLE_SPIRV_CODEGEN - IOP_Vkext_execution_mode, -#endif // ENABLE_SPIRV_CODEGEN -#ifdef ENABLE_SPIRV_CODEGEN - IOP_Vkext_execution_mode_id, -#endif // ENABLE_SPIRV_CODEGEN - MOP_Append, - MOP_RestartStrip, - MOP_CalculateLevelOfDetail, - MOP_CalculateLevelOfDetailUnclamped, - MOP_GetDimensions, - MOP_Load, - MOP_Sample, - MOP_SampleBias, - MOP_SampleCmp, - MOP_SampleCmpBias, - MOP_SampleCmpGrad, - MOP_SampleCmpLevel, - MOP_SampleCmpLevelZero, - MOP_SampleGrad, - MOP_SampleLevel, - MOP_Gather, - MOP_GatherAlpha, - MOP_GatherBlue, - MOP_GatherCmp, - MOP_GatherCmpAlpha, - MOP_GatherCmpBlue, - MOP_GatherCmpGreen, - MOP_GatherCmpRed, - MOP_GatherGreen, - MOP_GatherRaw, - MOP_GatherRed, - MOP_GetSamplePosition, - MOP_Load2, - MOP_Load3, - MOP_Load4, - MOP_InterlockedAdd, - MOP_InterlockedAdd64, - MOP_InterlockedAnd, - MOP_InterlockedAnd64, - MOP_InterlockedCompareExchange, - MOP_InterlockedCompareExchange64, - MOP_InterlockedCompareExchangeFloatBitwise, - MOP_InterlockedCompareStore, - MOP_InterlockedCompareStore64, - MOP_InterlockedCompareStoreFloatBitwise, - MOP_InterlockedExchange, - MOP_InterlockedExchange64, - MOP_InterlockedExchangeFloat, - MOP_InterlockedMax, - MOP_InterlockedMax64, - MOP_InterlockedMin, - MOP_InterlockedMin64, - MOP_InterlockedOr, - MOP_InterlockedOr64, - MOP_InterlockedXor, - MOP_InterlockedXor64, - MOP_Store, - MOP_Store2, - MOP_Store3, - MOP_Store4, - MOP_DecrementCounter, - MOP_IncrementCounter, - MOP_Consume, - MOP_WriteSamplerFeedback, - MOP_WriteSamplerFeedbackBias, - MOP_WriteSamplerFeedbackGrad, - MOP_WriteSamplerFeedbackLevel, - MOP_Abort, - MOP_CandidateGeometryIndex, - MOP_CandidateInstanceContributionToHitGroupIndex, - MOP_CandidateInstanceID, - MOP_CandidateInstanceIndex, - MOP_CandidateObjectRayDirection, - MOP_CandidateObjectRayOrigin, - MOP_CandidateObjectToWorld3x4, - MOP_CandidateObjectToWorld4x3, - MOP_CandidatePrimitiveIndex, - MOP_CandidateProceduralPrimitiveNonOpaque, - MOP_CandidateTriangleBarycentrics, - MOP_CandidateTriangleFrontFace, - MOP_CandidateTriangleRayT, - MOP_CandidateType, - MOP_CandidateWorldToObject3x4, - MOP_CandidateWorldToObject4x3, - MOP_CommitNonOpaqueTriangleHit, - MOP_CommitProceduralPrimitiveHit, - MOP_CommittedGeometryIndex, - MOP_CommittedInstanceContributionToHitGroupIndex, - MOP_CommittedInstanceID, - MOP_CommittedInstanceIndex, - MOP_CommittedObjectRayDirection, - MOP_CommittedObjectRayOrigin, - MOP_CommittedObjectToWorld3x4, - MOP_CommittedObjectToWorld4x3, - MOP_CommittedPrimitiveIndex, - MOP_CommittedRayT, - MOP_CommittedStatus, - MOP_CommittedTriangleBarycentrics, - MOP_CommittedTriangleFrontFace, - MOP_CommittedWorldToObject3x4, - MOP_CommittedWorldToObject4x3, - MOP_Proceed, - MOP_RayFlags, - MOP_RayTMin, - MOP_TraceRayInline, - MOP_WorldRayDirection, - MOP_WorldRayOrigin, - MOP_Count, - MOP_FinishedCrossGroupSharing, - MOP_GetGroupNodeOutputRecords, - MOP_GetThreadNodeOutputRecords, - MOP_IsValid, - MOP_GroupIncrementOutputCount, - MOP_ThreadIncrementOutputCount, - MOP_OutputComplete, -#ifdef ENABLE_SPIRV_CODEGEN - MOP_SubpassLoad, -#endif // ENABLE_SPIRV_CODEGEN + IOP_AcceptHitAndEndSearch = 0, + IOP_AddUint64 = 1, + IOP_AllMemoryBarrier = 2, + IOP_AllMemoryBarrierWithGroupSync = 3, + IOP_AllocateRayQuery = 4, + IOP_Barrier = 5, + IOP_CallShader = 6, + IOP_CheckAccessFullyMapped = 7, + IOP_CreateResourceFromHeap = 8, + IOP_D3DCOLORtoUBYTE4 = 9, + IOP_DeviceMemoryBarrier = 10, + IOP_DeviceMemoryBarrierWithGroupSync = 11, + IOP_DispatchMesh = 12, + IOP_DispatchRaysDimensions = 13, + IOP_DispatchRaysIndex = 14, + IOP_EvaluateAttributeAtSample = 15, + IOP_EvaluateAttributeCentroid = 16, + IOP_EvaluateAttributeSnapped = 17, + IOP_GeometryIndex = 18, + IOP_GetAttributeAtVertex = 19, + IOP_GetRemainingRecursionLevels = 20, + IOP_GetRenderTargetSampleCount = 21, + IOP_GetRenderTargetSamplePosition = 22, + IOP_GroupMemoryBarrier = 23, + IOP_GroupMemoryBarrierWithGroupSync = 24, + IOP_HitKind = 25, + IOP_IgnoreHit = 26, + IOP_InstanceID = 27, + IOP_InstanceIndex = 28, + IOP_InterlockedAdd = 29, + IOP_InterlockedAnd = 30, + IOP_InterlockedCompareExchange = 31, + IOP_InterlockedCompareExchangeFloatBitwise = 32, + IOP_InterlockedCompareStore = 33, + IOP_InterlockedCompareStoreFloatBitwise = 34, + IOP_InterlockedExchange = 35, + IOP_InterlockedMax = 36, + IOP_InterlockedMin = 37, + IOP_InterlockedOr = 38, + IOP_InterlockedXor = 39, + IOP_IsHelperLane = 40, + IOP_NonUniformResourceIndex = 41, + IOP_ObjectRayDirection = 42, + IOP_ObjectRayOrigin = 43, + IOP_ObjectToWorld = 44, + IOP_ObjectToWorld3x4 = 45, + IOP_ObjectToWorld4x3 = 46, + IOP_PrimitiveIndex = 47, + IOP_Process2DQuadTessFactorsAvg = 48, + IOP_Process2DQuadTessFactorsMax = 49, + IOP_Process2DQuadTessFactorsMin = 50, + IOP_ProcessIsolineTessFactors = 51, + IOP_ProcessQuadTessFactorsAvg = 52, + IOP_ProcessQuadTessFactorsMax = 53, + IOP_ProcessQuadTessFactorsMin = 54, + IOP_ProcessTriTessFactorsAvg = 55, + IOP_ProcessTriTessFactorsMax = 56, + IOP_ProcessTriTessFactorsMin = 57, + IOP_QuadAll = 58, + IOP_QuadAny = 59, + IOP_QuadReadAcrossDiagonal = 60, + IOP_QuadReadAcrossX = 61, + IOP_QuadReadAcrossY = 62, + IOP_QuadReadLaneAt = 63, + IOP_RayFlags = 64, + IOP_RayTCurrent = 65, + IOP_RayTMin = 66, + IOP_ReportHit = 67, + IOP_SetMeshOutputCounts = 68, + IOP_TraceRay = 69, + IOP_WaveActiveAllEqual = 70, + IOP_WaveActiveAllTrue = 71, + IOP_WaveActiveAnyTrue = 72, + IOP_WaveActiveBallot = 73, + IOP_WaveActiveBitAnd = 74, + IOP_WaveActiveBitOr = 75, + IOP_WaveActiveBitXor = 76, + IOP_WaveActiveCountBits = 77, + IOP_WaveActiveMax = 78, + IOP_WaveActiveMin = 79, + IOP_WaveActiveProduct = 80, + IOP_WaveActiveSum = 81, + IOP_WaveGetLaneCount = 82, + IOP_WaveGetLaneIndex = 83, + IOP_WaveIsFirstLane = 84, + IOP_WaveMatch = 85, + IOP_WaveMultiPrefixBitAnd = 86, + IOP_WaveMultiPrefixBitOr = 87, + IOP_WaveMultiPrefixBitXor = 88, + IOP_WaveMultiPrefixCountBits = 89, + IOP_WaveMultiPrefixProduct = 90, + IOP_WaveMultiPrefixSum = 91, + IOP_WavePrefixCountBits = 92, + IOP_WavePrefixProduct = 93, + IOP_WavePrefixSum = 94, + IOP_WaveReadLaneAt = 95, + IOP_WaveReadLaneFirst = 96, + IOP_WorldRayDirection = 97, + IOP_WorldRayOrigin = 98, + IOP_WorldToObject = 99, + IOP_WorldToObject3x4 = 100, + IOP_WorldToObject4x3 = 101, + IOP_abort = 102, + IOP_abs = 103, + IOP_acos = 104, + IOP_all = 105, + IOP_and = 106, + IOP_any = 107, + IOP_asdouble = 108, + IOP_asfloat = 109, + IOP_asfloat16 = 110, + IOP_asin = 111, + IOP_asint = 112, + IOP_asint16 = 113, + IOP_asuint = 114, + IOP_asuint16 = 115, + IOP_atan = 116, + IOP_atan2 = 117, + IOP_ceil = 118, + IOP_clamp = 119, + IOP_clip = 120, + IOP_cos = 121, + IOP_cosh = 122, + IOP_countbits = 123, + IOP_cross = 124, + IOP_ddx = 125, + IOP_ddx_coarse = 126, + IOP_ddx_fine = 127, + IOP_ddy = 128, + IOP_ddy_coarse = 129, + IOP_ddy_fine = 130, + IOP_degrees = 131, + IOP_determinant = 132, + IOP_distance = 133, + IOP_dot = 134, + IOP_dot2add = 135, + IOP_dot4add_i8packed = 136, + IOP_dot4add_u8packed = 137, + IOP_dst = 138, + IOP_exp = 139, + IOP_exp2 = 140, + IOP_f16tof32 = 141, + IOP_f32tof16 = 142, + IOP_faceforward = 143, + IOP_firstbithigh = 144, + IOP_firstbitlow = 145, + IOP_floor = 146, + IOP_fma = 147, + IOP_fmod = 148, + IOP_frac = 149, + IOP_frexp = 150, + IOP_fwidth = 151, + IOP_isfinite = 152, + IOP_isinf = 153, + IOP_isnan = 154, + IOP_ldexp = 155, + IOP_length = 156, + IOP_lerp = 157, + IOP_lit = 158, + IOP_log = 159, + IOP_log10 = 160, + IOP_log2 = 161, + IOP_mad = 162, + IOP_max = 163, + IOP_min = 164, + IOP_modf = 165, + IOP_msad4 = 166, + IOP_mul = 167, + IOP_normalize = 168, + IOP_or = 169, + IOP_pack_clamp_s8 = 170, + IOP_pack_clamp_u8 = 171, + IOP_pack_s8 = 172, + IOP_pack_u8 = 173, + IOP_pow = 174, + IOP_printf = 175, + IOP_radians = 176, + IOP_rcp = 177, + IOP_reflect = 178, + IOP_refract = 179, + IOP_reversebits = 180, + IOP_round = 181, + IOP_rsqrt = 182, + IOP_saturate = 183, + IOP_select = 184, + IOP_sign = 185, + IOP_sin = 186, + IOP_sincos = 187, + IOP_sinh = 188, + IOP_smoothstep = 189, + IOP_source_mark = 190, + IOP_sqrt = 191, + IOP_step = 192, + IOP_tan = 193, + IOP_tanh = 194, + IOP_tex1D = 195, + IOP_tex1Dbias = 196, + IOP_tex1Dgrad = 197, + IOP_tex1Dlod = 198, + IOP_tex1Dproj = 199, + IOP_tex2D = 200, + IOP_tex2Dbias = 201, + IOP_tex2Dgrad = 202, + IOP_tex2Dlod = 203, + IOP_tex2Dproj = 204, + IOP_tex3D = 205, + IOP_tex3Dbias = 206, + IOP_tex3Dgrad = 207, + IOP_tex3Dlod = 208, + IOP_tex3Dproj = 209, + IOP_texCUBE = 210, + IOP_texCUBEbias = 211, + IOP_texCUBEgrad = 212, + IOP_texCUBElod = 213, + IOP_texCUBEproj = 214, + IOP_transpose = 215, + IOP_trunc = 216, + IOP_unpack_s8s16 = 217, + IOP_unpack_s8s32 = 218, + IOP_unpack_u8u16 = 219, + IOP_unpack_u8u32 = 220, + IOP_VkRawBufferLoad = 221, + IOP_VkRawBufferStore = 222, + IOP_VkReadClock = 223, + IOP_Vkext_execution_mode = 224, + IOP_Vkext_execution_mode_id = 225, + MOP_Append = 226, + MOP_RestartStrip = 227, + MOP_CalculateLevelOfDetail = 228, + MOP_CalculateLevelOfDetailUnclamped = 229, + MOP_GetDimensions = 230, + MOP_Load = 231, + MOP_Sample = 232, + MOP_SampleBias = 233, + MOP_SampleCmp = 234, + MOP_SampleCmpBias = 235, + MOP_SampleCmpGrad = 236, + MOP_SampleCmpLevel = 237, + MOP_SampleCmpLevelZero = 238, + MOP_SampleGrad = 239, + MOP_SampleLevel = 240, + MOP_Gather = 241, + MOP_GatherAlpha = 242, + MOP_GatherBlue = 243, + MOP_GatherCmp = 244, + MOP_GatherCmpAlpha = 245, + MOP_GatherCmpBlue = 246, + MOP_GatherCmpGreen = 247, + MOP_GatherCmpRed = 248, + MOP_GatherGreen = 249, + MOP_GatherRaw = 250, + MOP_GatherRed = 251, + MOP_GetSamplePosition = 252, + MOP_Load2 = 253, + MOP_Load3 = 254, + MOP_Load4 = 255, + MOP_InterlockedAdd = 256, + MOP_InterlockedAdd64 = 257, + MOP_InterlockedAnd = 258, + MOP_InterlockedAnd64 = 259, + MOP_InterlockedCompareExchange = 260, + MOP_InterlockedCompareExchange64 = 261, + MOP_InterlockedCompareExchangeFloatBitwise = 262, + MOP_InterlockedCompareStore = 263, + MOP_InterlockedCompareStore64 = 264, + MOP_InterlockedCompareStoreFloatBitwise = 265, + MOP_InterlockedExchange = 266, + MOP_InterlockedExchange64 = 267, + MOP_InterlockedExchangeFloat = 268, + MOP_InterlockedMax = 269, + MOP_InterlockedMax64 = 270, + MOP_InterlockedMin = 271, + MOP_InterlockedMin64 = 272, + MOP_InterlockedOr = 273, + MOP_InterlockedOr64 = 274, + MOP_InterlockedXor = 275, + MOP_InterlockedXor64 = 276, + MOP_Store = 277, + MOP_Store2 = 278, + MOP_Store3 = 279, + MOP_Store4 = 280, + MOP_DecrementCounter = 281, + MOP_IncrementCounter = 282, + MOP_Consume = 283, + MOP_WriteSamplerFeedback = 284, + MOP_WriteSamplerFeedbackBias = 285, + MOP_WriteSamplerFeedbackGrad = 286, + MOP_WriteSamplerFeedbackLevel = 287, + MOP_Abort = 288, + MOP_CandidateGeometryIndex = 289, + MOP_CandidateInstanceContributionToHitGroupIndex = 290, + MOP_CandidateInstanceID = 291, + MOP_CandidateInstanceIndex = 292, + MOP_CandidateObjectRayDirection = 293, + MOP_CandidateObjectRayOrigin = 294, + MOP_CandidateObjectToWorld3x4 = 295, + MOP_CandidateObjectToWorld4x3 = 296, + MOP_CandidatePrimitiveIndex = 297, + MOP_CandidateProceduralPrimitiveNonOpaque = 298, + MOP_CandidateTriangleBarycentrics = 299, + MOP_CandidateTriangleFrontFace = 300, + MOP_CandidateTriangleRayT = 301, + MOP_CandidateType = 302, + MOP_CandidateWorldToObject3x4 = 303, + MOP_CandidateWorldToObject4x3 = 304, + MOP_CommitNonOpaqueTriangleHit = 305, + MOP_CommitProceduralPrimitiveHit = 306, + MOP_CommittedGeometryIndex = 307, + MOP_CommittedInstanceContributionToHitGroupIndex = 308, + MOP_CommittedInstanceID = 309, + MOP_CommittedInstanceIndex = 310, + MOP_CommittedObjectRayDirection = 311, + MOP_CommittedObjectRayOrigin = 312, + MOP_CommittedObjectToWorld3x4 = 313, + MOP_CommittedObjectToWorld4x3 = 314, + MOP_CommittedPrimitiveIndex = 315, + MOP_CommittedRayT = 316, + MOP_CommittedStatus = 317, + MOP_CommittedTriangleBarycentrics = 318, + MOP_CommittedTriangleFrontFace = 319, + MOP_CommittedWorldToObject3x4 = 320, + MOP_CommittedWorldToObject4x3 = 321, + MOP_Proceed = 322, + MOP_RayFlags = 323, + MOP_RayTMin = 324, + MOP_TraceRayInline = 325, + MOP_WorldRayDirection = 326, + MOP_WorldRayOrigin = 327, + MOP_Count = 328, + MOP_FinishedCrossGroupSharing = 329, + MOP_GetGroupNodeOutputRecords = 330, + MOP_GetThreadNodeOutputRecords = 331, + MOP_IsValid = 332, + MOP_GroupIncrementOutputCount = 333, + MOP_ThreadIncrementOutputCount = 334, + MOP_OutputComplete = 335, + MOP_SubpassLoad = 336, // unsigned - IOP_InterlockedUMax, - IOP_InterlockedUMin, - IOP_WaveActiveUMax, - IOP_WaveActiveUMin, - IOP_WaveActiveUProduct, - IOP_WaveActiveUSum, - IOP_WaveMultiPrefixUProduct, - IOP_WaveMultiPrefixUSum, - IOP_WavePrefixUProduct, - IOP_WavePrefixUSum, - IOP_uabs, - IOP_uclamp, - IOP_udot, - IOP_ufirstbithigh, - IOP_umad, - IOP_umax, - IOP_umin, - IOP_umul, - IOP_usign, - MOP_InterlockedUMax, - MOP_InterlockedUMin, - Num_Intrinsics, + IOP_InterlockedUMax = 337, + IOP_InterlockedUMin = 338, + IOP_WaveActiveUMax = 339, + IOP_WaveActiveUMin = 340, + IOP_WaveActiveUProduct = 341, + IOP_WaveActiveUSum = 342, + IOP_WaveMultiPrefixUProduct = 343, + IOP_WaveMultiPrefixUSum = 344, + IOP_WavePrefixUProduct = 345, + IOP_WavePrefixUSum = 346, + IOP_uabs = 347, + IOP_uclamp = 348, + IOP_udot = 349, + IOP_ufirstbithigh = 350, + IOP_umad = 351, + IOP_umax = 352, + IOP_umin = 353, + IOP_umul = 354, + IOP_usign = 355, + MOP_InterlockedUMax = 356, + MOP_InterlockedUMin = 357, + Num_Intrinsics = 358, }; inline bool HasUnsignedIntrinsicOpcode(IntrinsicOp opcode) { switch (opcode) { diff --git a/lib/HLSL/HLOperationLower.cpp b/lib/HLSL/HLOperationLower.cpp index c8906a1cd2..d218136bd7 100644 --- a/lib/HLSL/HLOperationLower.cpp +++ b/lib/HLSL/HLOperationLower.cpp @@ -6270,7 +6270,6 @@ Value *EmptyLower(CallInst *CI, IntrinsicOp IOP, DXIL::OpCode opcode, } // SPIRV change starts -#ifdef ENABLE_SPIRV_CODEGEN Value *UnsupportedVulkanIntrinsic(CallInst *CI, IntrinsicOp IOP, DXIL::OpCode opcode, HLOperationLowerHelper &helper, @@ -6280,7 +6279,6 @@ Value *UnsupportedVulkanIntrinsic(CallInst *CI, IntrinsicOp IOP, dxilutil::EmitErrorOnInstruction(CI, "Unsupported Vulkan intrinsic."); return nullptr; } -#endif // ENABLE_SPIRV_CODEGEN // SPIRV change ends Value *StreamOutputLower(CallInst *CI, IntrinsicOp IOP, DXIL::OpCode opcode, @@ -6625,7 +6623,6 @@ IntrinsicLower gLowerTable[] = { {IntrinsicOp::IOP_unpack_s8s32, TranslateUnpack, DXIL::OpCode::Unpack4x8}, {IntrinsicOp::IOP_unpack_u8u16, TranslateUnpack, DXIL::OpCode::Unpack4x8}, {IntrinsicOp::IOP_unpack_u8u32, TranslateUnpack, DXIL::OpCode::Unpack4x8}, -#ifdef ENABLE_SPIRV_CODEGEN {IntrinsicOp::IOP_VkRawBufferLoad, UnsupportedVulkanIntrinsic, DXIL::OpCode::NumOpCodes}, {IntrinsicOp::IOP_VkRawBufferStore, UnsupportedVulkanIntrinsic, @@ -6636,7 +6633,6 @@ IntrinsicLower gLowerTable[] = { DXIL::OpCode::NumOpCodes}, {IntrinsicOp::IOP_Vkext_execution_mode_id, UnsupportedVulkanIntrinsic, DXIL::OpCode::NumOpCodes}, -#endif // ENABLE_SPIRV_CODEGEN {IntrinsicOp::MOP_Append, StreamOutputLower, DXIL::OpCode::EmitStream}, {IntrinsicOp::MOP_RestartStrip, StreamOutputLower, DXIL::OpCode::CutStream}, {IntrinsicOp::MOP_CalculateLevelOfDetail, TranslateCalculateLOD, @@ -6864,11 +6860,9 @@ IntrinsicLower gLowerTable[] = { {IntrinsicOp::MOP_OutputComplete, TranslateNodeOutputComplete, DXIL::OpCode::OutputComplete}, -// SPIRV change starts -#ifdef ENABLE_SPIRV_CODEGEN + // SPIRV change starts {IntrinsicOp::MOP_SubpassLoad, UnsupportedVulkanIntrinsic, DXIL::OpCode::NumOpCodes}, -#endif // ENABLE_SPIRV_CODEGEN // SPIRV change ends // Manually added part. diff --git a/utils/hct/CMakeLists.txt b/utils/hct/CMakeLists.txt new file mode 100644 index 0000000000..41e6b494e6 --- /dev/null +++ b/utils/hct/CMakeLists.txt @@ -0,0 +1,3 @@ +# generate hlsl_intrinsic_opcodes.json to preserve high level intrinsic opcodes +# This uses CODE_TAG because the file exists in the source tree. +add_hlsl_hctgen(HlslIntrinsicOpcodes OUTPUT hlsl_intrinsic_opcodes.json CODE_TAG) diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 9d4eb87f2d..3759849ebe 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -8358,6 +8358,8 @@ def __init__( self.vulkanSpecific = ns.startswith( "Vk" ) # Vulkan specific intrinsic - SPIRV change + self.opcode = None # high-level opcode assigned later + self.unsigned_opcode = None # unsigned high-level opcode if appicable class db_hlsl_namespace(object): @@ -8399,11 +8401,10 @@ def __init__( self.template_id_idx = template_id_idx # Template ID numeric value self.component_id_idx = component_id_idx # Component ID numeric value - class db_hlsl(object): "A database of HLSL language data" - def __init__(self, intrinsic_defs): + def __init__(self, intrinsic_defs, opcode_data): self.base_types = { "bool": "LICOMPTYPE_BOOL", "int": "LICOMPTYPE_INT", @@ -8476,6 +8477,13 @@ def __init__(self, intrinsic_defs): self.populate_attributes() self.opcode_namespace = "hlsl::IntrinsicOp" + # Populate opcode data for HLSL intrinsics. + self.opcode_data = opcode_data + # If opcode data is empty, create the default structure. + if not self.opcode_data: + self.opcode_data["IntrinsicOpCodes"] = {"Num_Intrinsics": 0} + self.assign_opcodes() + def create_namespaces(self): last_ns = None self.namespaces = {} @@ -8980,6 +8988,29 @@ def add_attr_arg(title_name, scope, args, doc): ) self.attributes = attributes + # Iterate through all intrinsics, assigning opcodes to each one. + # This uses the opcode_data to preserve already-assigned opcodes. + def assign_opcodes(self): + "Assign opcodes to the intrinsics." + IntrinsicOpDict = self.opcode_data["IntrinsicOpCodes"] + Num_Intrinsics = self.opcode_data["IntrinsicOpCodes"]["Num_Intrinsics"] + + def add_intrinsic(name): + nonlocal Num_Intrinsics + opcode = IntrinsicOpDict.setdefault(name, Num_Intrinsics) + if opcode == Num_Intrinsics: + Num_Intrinsics += 1 + return opcode + + sorted_intrinsics = sorted(self.intrinsics, key=lambda x: x.key) + for i in sorted_intrinsics: + i.opcode = add_intrinsic(i.enum_name) + for i in sorted_intrinsics: + if i.unsigned_op == "": + continue + i.unsigned_opcode = add_intrinsic(i.unsigned_op) + self.opcode_data["IntrinsicOpCodes"]["Num_Intrinsics"] = Num_Intrinsics + if __name__ == "__main__": db = db_dxil() diff --git a/utils/hct/hctdb_instrhelp.py b/utils/hct/hctdb_instrhelp.py index 12ce6f8544..680cfd6923 100644 --- a/utils/hct/hctdb_instrhelp.py +++ b/utils/hct/hctdb_instrhelp.py @@ -18,15 +18,36 @@ def get_db_dxil(): return g_db_dxil -g_db_hlsl = None +# opcode data contains fixed opcode assignments for HLSL intrinsics. +g_hlsl_opcode_data = None + + +def get_hlsl_opcode_data(): + global g_hlsl_opcode_data + if g_hlsl_opcode_data is None: + # Load the intrinsic opcodes from the JSON file. + json_filepath = os.path.join( + os.path.dirname(__file__), "hlsl_intrinsic_opcodes.json" + ) + try: + with open(json_filepath, "r") as file: + g_hlsl_opcode_data = json.load(file) + except FileNotFoundError: + print(f"File not found: {json_filepath}") + except json.JSONDecodeError as e: + print(f"Error decoding JSON from {json_filepath}: {e}") + if not g_hlsl_opcode_data: + g_hlsl_opcode_data = {} + return g_hlsl_opcode_data +g_db_hlsl = None def get_db_hlsl(): global g_db_hlsl if g_db_hlsl is None: thisdir = os.path.dirname(os.path.realpath(__file__)) with open(os.path.join(thisdir, "gen_intrin_main.txt"), "r") as f: - g_db_hlsl = db_hlsl(f) + g_db_hlsl = db_hlsl(f, get_hlsl_opcode_data()) return g_db_hlsl @@ -1047,22 +1068,22 @@ def wrap_with_ifdef_if_vulkan_specific(intrinsic, text): def enum_hlsl_intrinsics(): db = get_db_hlsl() result = "" - enumed = [] + enumed = set() for i in sorted(db.intrinsics, key=lambda x: x.key): if i.enum_name not in enumed: - enumerant = " %s,\n" % (i.enum_name) - result += wrap_with_ifdef_if_vulkan_specific(i, enumerant) # SPIRV Change - enumed.append(i.enum_name) + result += " %s = %d,\n" % (i.enum_name, i.opcode) + enumed.add(i.enum_name) # unsigned result += " // unsigned\n" for i in sorted(db.intrinsics, key=lambda x: x.key): if i.unsigned_op != "": if i.unsigned_op not in enumed: - result += " %s,\n" % (i.unsigned_op) - enumed.append(i.unsigned_op) + result += " %s = %d,\n" % (i.unsigned_op, i.unsigned_opcode) + enumed.add(i.unsigned_op) - result += " Num_Intrinsics,\n" + Num_Intrinsics = get_hlsl_opcode_data()["IntrinsicOpCodes"]["Num_Intrinsics"] + result += " Num_Intrinsics = %d,\n" % (Num_Intrinsics) return result diff --git a/utils/hct/hctgen.py b/utils/hct/hctgen.py index dbb7e3a745..1421fbfad5 100755 --- a/utils/hct/hctgen.py +++ b/utils/hct/hctgen.py @@ -2,6 +2,7 @@ import argparse from hctdb_instrhelp import * from hctdb import * +import json import sys import os import CodeTags @@ -28,6 +29,7 @@ "DxilCounters", "DxilMetadata", "RDAT_LibraryTypes", + "HlslIntrinsicOpcodes", ], ) parser.add_argument("--output", required=True) @@ -232,6 +234,14 @@ def writeDxilPIXPasses(args): return 0 +def writeHlslIntrinsicOpcodes(args): + out = openOutput(args) + # get_db_hlsl() initializes the hlsl intrinsic database and opcode_data. + get_db_hlsl() + json.dump(get_hlsl_opcode_data(), out, indent=2) + out.write("\n") + return 0 + args = parser.parse_args() if args.force_lf and args.force_crlf: eprint("--force-lf and --force-crlf are mutually exclusive, only pass one") diff --git a/utils/hct/hlsl_intrinsic_opcodes.json b/utils/hct/hlsl_intrinsic_opcodes.json new file mode 100644 index 0000000000..48a0b74c17 --- /dev/null +++ b/utils/hct/hlsl_intrinsic_opcodes.json @@ -0,0 +1,363 @@ +{ + "IntrinsicOpCodes": { + "Num_Intrinsics": 358, + "IOP_AcceptHitAndEndSearch": 0, + "IOP_AddUint64": 1, + "IOP_AllMemoryBarrier": 2, + "IOP_AllMemoryBarrierWithGroupSync": 3, + "IOP_AllocateRayQuery": 4, + "IOP_Barrier": 5, + "IOP_CallShader": 6, + "IOP_CheckAccessFullyMapped": 7, + "IOP_CreateResourceFromHeap": 8, + "IOP_D3DCOLORtoUBYTE4": 9, + "IOP_DeviceMemoryBarrier": 10, + "IOP_DeviceMemoryBarrierWithGroupSync": 11, + "IOP_DispatchMesh": 12, + "IOP_DispatchRaysDimensions": 13, + "IOP_DispatchRaysIndex": 14, + "IOP_EvaluateAttributeAtSample": 15, + "IOP_EvaluateAttributeCentroid": 16, + "IOP_EvaluateAttributeSnapped": 17, + "IOP_GeometryIndex": 18, + "IOP_GetAttributeAtVertex": 19, + "IOP_GetRemainingRecursionLevels": 20, + "IOP_GetRenderTargetSampleCount": 21, + "IOP_GetRenderTargetSamplePosition": 22, + "IOP_GroupMemoryBarrier": 23, + "IOP_GroupMemoryBarrierWithGroupSync": 24, + "IOP_HitKind": 25, + "IOP_IgnoreHit": 26, + "IOP_InstanceID": 27, + "IOP_InstanceIndex": 28, + "IOP_InterlockedAdd": 29, + "IOP_InterlockedAnd": 30, + "IOP_InterlockedCompareExchange": 31, + "IOP_InterlockedCompareExchangeFloatBitwise": 32, + "IOP_InterlockedCompareStore": 33, + "IOP_InterlockedCompareStoreFloatBitwise": 34, + "IOP_InterlockedExchange": 35, + "IOP_InterlockedMax": 36, + "IOP_InterlockedMin": 37, + "IOP_InterlockedOr": 38, + "IOP_InterlockedXor": 39, + "IOP_IsHelperLane": 40, + "IOP_NonUniformResourceIndex": 41, + "IOP_ObjectRayDirection": 42, + "IOP_ObjectRayOrigin": 43, + "IOP_ObjectToWorld": 44, + "IOP_ObjectToWorld3x4": 45, + "IOP_ObjectToWorld4x3": 46, + "IOP_PrimitiveIndex": 47, + "IOP_Process2DQuadTessFactorsAvg": 48, + "IOP_Process2DQuadTessFactorsMax": 49, + "IOP_Process2DQuadTessFactorsMin": 50, + "IOP_ProcessIsolineTessFactors": 51, + "IOP_ProcessQuadTessFactorsAvg": 52, + "IOP_ProcessQuadTessFactorsMax": 53, + "IOP_ProcessQuadTessFactorsMin": 54, + "IOP_ProcessTriTessFactorsAvg": 55, + "IOP_ProcessTriTessFactorsMax": 56, + "IOP_ProcessTriTessFactorsMin": 57, + "IOP_QuadAll": 58, + "IOP_QuadAny": 59, + "IOP_QuadReadAcrossDiagonal": 60, + "IOP_QuadReadAcrossX": 61, + "IOP_QuadReadAcrossY": 62, + "IOP_QuadReadLaneAt": 63, + "IOP_RayFlags": 64, + "IOP_RayTCurrent": 65, + "IOP_RayTMin": 66, + "IOP_ReportHit": 67, + "IOP_SetMeshOutputCounts": 68, + "IOP_TraceRay": 69, + "IOP_WaveActiveAllEqual": 70, + "IOP_WaveActiveAllTrue": 71, + "IOP_WaveActiveAnyTrue": 72, + "IOP_WaveActiveBallot": 73, + "IOP_WaveActiveBitAnd": 74, + "IOP_WaveActiveBitOr": 75, + "IOP_WaveActiveBitXor": 76, + "IOP_WaveActiveCountBits": 77, + "IOP_WaveActiveMax": 78, + "IOP_WaveActiveMin": 79, + "IOP_WaveActiveProduct": 80, + "IOP_WaveActiveSum": 81, + "IOP_WaveGetLaneCount": 82, + "IOP_WaveGetLaneIndex": 83, + "IOP_WaveIsFirstLane": 84, + "IOP_WaveMatch": 85, + "IOP_WaveMultiPrefixBitAnd": 86, + "IOP_WaveMultiPrefixBitOr": 87, + "IOP_WaveMultiPrefixBitXor": 88, + "IOP_WaveMultiPrefixCountBits": 89, + "IOP_WaveMultiPrefixProduct": 90, + "IOP_WaveMultiPrefixSum": 91, + "IOP_WavePrefixCountBits": 92, + "IOP_WavePrefixProduct": 93, + "IOP_WavePrefixSum": 94, + "IOP_WaveReadLaneAt": 95, + "IOP_WaveReadLaneFirst": 96, + "IOP_WorldRayDirection": 97, + "IOP_WorldRayOrigin": 98, + "IOP_WorldToObject": 99, + "IOP_WorldToObject3x4": 100, + "IOP_WorldToObject4x3": 101, + "IOP_abort": 102, + "IOP_abs": 103, + "IOP_acos": 104, + "IOP_all": 105, + "IOP_and": 106, + "IOP_any": 107, + "IOP_asdouble": 108, + "IOP_asfloat": 109, + "IOP_asfloat16": 110, + "IOP_asin": 111, + "IOP_asint": 112, + "IOP_asint16": 113, + "IOP_asuint": 114, + "IOP_asuint16": 115, + "IOP_atan": 116, + "IOP_atan2": 117, + "IOP_ceil": 118, + "IOP_clamp": 119, + "IOP_clip": 120, + "IOP_cos": 121, + "IOP_cosh": 122, + "IOP_countbits": 123, + "IOP_cross": 124, + "IOP_ddx": 125, + "IOP_ddx_coarse": 126, + "IOP_ddx_fine": 127, + "IOP_ddy": 128, + "IOP_ddy_coarse": 129, + "IOP_ddy_fine": 130, + "IOP_degrees": 131, + "IOP_determinant": 132, + "IOP_distance": 133, + "IOP_dot": 134, + "IOP_dot2add": 135, + "IOP_dot4add_i8packed": 136, + "IOP_dot4add_u8packed": 137, + "IOP_dst": 138, + "IOP_exp": 139, + "IOP_exp2": 140, + "IOP_f16tof32": 141, + "IOP_f32tof16": 142, + "IOP_faceforward": 143, + "IOP_firstbithigh": 144, + "IOP_firstbitlow": 145, + "IOP_floor": 146, + "IOP_fma": 147, + "IOP_fmod": 148, + "IOP_frac": 149, + "IOP_frexp": 150, + "IOP_fwidth": 151, + "IOP_isfinite": 152, + "IOP_isinf": 153, + "IOP_isnan": 154, + "IOP_ldexp": 155, + "IOP_length": 156, + "IOP_lerp": 157, + "IOP_lit": 158, + "IOP_log": 159, + "IOP_log10": 160, + "IOP_log2": 161, + "IOP_mad": 162, + "IOP_max": 163, + "IOP_min": 164, + "IOP_modf": 165, + "IOP_msad4": 166, + "IOP_mul": 167, + "IOP_normalize": 168, + "IOP_or": 169, + "IOP_pack_clamp_s8": 170, + "IOP_pack_clamp_u8": 171, + "IOP_pack_s8": 172, + "IOP_pack_u8": 173, + "IOP_pow": 174, + "IOP_printf": 175, + "IOP_radians": 176, + "IOP_rcp": 177, + "IOP_reflect": 178, + "IOP_refract": 179, + "IOP_reversebits": 180, + "IOP_round": 181, + "IOP_rsqrt": 182, + "IOP_saturate": 183, + "IOP_select": 184, + "IOP_sign": 185, + "IOP_sin": 186, + "IOP_sincos": 187, + "IOP_sinh": 188, + "IOP_smoothstep": 189, + "IOP_source_mark": 190, + "IOP_sqrt": 191, + "IOP_step": 192, + "IOP_tan": 193, + "IOP_tanh": 194, + "IOP_tex1D": 195, + "IOP_tex1Dbias": 196, + "IOP_tex1Dgrad": 197, + "IOP_tex1Dlod": 198, + "IOP_tex1Dproj": 199, + "IOP_tex2D": 200, + "IOP_tex2Dbias": 201, + "IOP_tex2Dgrad": 202, + "IOP_tex2Dlod": 203, + "IOP_tex2Dproj": 204, + "IOP_tex3D": 205, + "IOP_tex3Dbias": 206, + "IOP_tex3Dgrad": 207, + "IOP_tex3Dlod": 208, + "IOP_tex3Dproj": 209, + "IOP_texCUBE": 210, + "IOP_texCUBEbias": 211, + "IOP_texCUBEgrad": 212, + "IOP_texCUBElod": 213, + "IOP_texCUBEproj": 214, + "IOP_transpose": 215, + "IOP_trunc": 216, + "IOP_unpack_s8s16": 217, + "IOP_unpack_s8s32": 218, + "IOP_unpack_u8u16": 219, + "IOP_unpack_u8u32": 220, + "IOP_VkRawBufferLoad": 221, + "IOP_VkRawBufferStore": 222, + "IOP_VkReadClock": 223, + "IOP_Vkext_execution_mode": 224, + "IOP_Vkext_execution_mode_id": 225, + "MOP_Append": 226, + "MOP_RestartStrip": 227, + "MOP_CalculateLevelOfDetail": 228, + "MOP_CalculateLevelOfDetailUnclamped": 229, + "MOP_GetDimensions": 230, + "MOP_Load": 231, + "MOP_Sample": 232, + "MOP_SampleBias": 233, + "MOP_SampleCmp": 234, + "MOP_SampleCmpBias": 235, + "MOP_SampleCmpGrad": 236, + "MOP_SampleCmpLevel": 237, + "MOP_SampleCmpLevelZero": 238, + "MOP_SampleGrad": 239, + "MOP_SampleLevel": 240, + "MOP_Gather": 241, + "MOP_GatherAlpha": 242, + "MOP_GatherBlue": 243, + "MOP_GatherCmp": 244, + "MOP_GatherCmpAlpha": 245, + "MOP_GatherCmpBlue": 246, + "MOP_GatherCmpGreen": 247, + "MOP_GatherCmpRed": 248, + "MOP_GatherGreen": 249, + "MOP_GatherRaw": 250, + "MOP_GatherRed": 251, + "MOP_GetSamplePosition": 252, + "MOP_Load2": 253, + "MOP_Load3": 254, + "MOP_Load4": 255, + "MOP_InterlockedAdd": 256, + "MOP_InterlockedAdd64": 257, + "MOP_InterlockedAnd": 258, + "MOP_InterlockedAnd64": 259, + "MOP_InterlockedCompareExchange": 260, + "MOP_InterlockedCompareExchange64": 261, + "MOP_InterlockedCompareExchangeFloatBitwise": 262, + "MOP_InterlockedCompareStore": 263, + "MOP_InterlockedCompareStore64": 264, + "MOP_InterlockedCompareStoreFloatBitwise": 265, + "MOP_InterlockedExchange": 266, + "MOP_InterlockedExchange64": 267, + "MOP_InterlockedExchangeFloat": 268, + "MOP_InterlockedMax": 269, + "MOP_InterlockedMax64": 270, + "MOP_InterlockedMin": 271, + "MOP_InterlockedMin64": 272, + "MOP_InterlockedOr": 273, + "MOP_InterlockedOr64": 274, + "MOP_InterlockedXor": 275, + "MOP_InterlockedXor64": 276, + "MOP_Store": 277, + "MOP_Store2": 278, + "MOP_Store3": 279, + "MOP_Store4": 280, + "MOP_DecrementCounter": 281, + "MOP_IncrementCounter": 282, + "MOP_Consume": 283, + "MOP_WriteSamplerFeedback": 284, + "MOP_WriteSamplerFeedbackBias": 285, + "MOP_WriteSamplerFeedbackGrad": 286, + "MOP_WriteSamplerFeedbackLevel": 287, + "MOP_Abort": 288, + "MOP_CandidateGeometryIndex": 289, + "MOP_CandidateInstanceContributionToHitGroupIndex": 290, + "MOP_CandidateInstanceID": 291, + "MOP_CandidateInstanceIndex": 292, + "MOP_CandidateObjectRayDirection": 293, + "MOP_CandidateObjectRayOrigin": 294, + "MOP_CandidateObjectToWorld3x4": 295, + "MOP_CandidateObjectToWorld4x3": 296, + "MOP_CandidatePrimitiveIndex": 297, + "MOP_CandidateProceduralPrimitiveNonOpaque": 298, + "MOP_CandidateTriangleBarycentrics": 299, + "MOP_CandidateTriangleFrontFace": 300, + "MOP_CandidateTriangleRayT": 301, + "MOP_CandidateType": 302, + "MOP_CandidateWorldToObject3x4": 303, + "MOP_CandidateWorldToObject4x3": 304, + "MOP_CommitNonOpaqueTriangleHit": 305, + "MOP_CommitProceduralPrimitiveHit": 306, + "MOP_CommittedGeometryIndex": 307, + "MOP_CommittedInstanceContributionToHitGroupIndex": 308, + "MOP_CommittedInstanceID": 309, + "MOP_CommittedInstanceIndex": 310, + "MOP_CommittedObjectRayDirection": 311, + "MOP_CommittedObjectRayOrigin": 312, + "MOP_CommittedObjectToWorld3x4": 313, + "MOP_CommittedObjectToWorld4x3": 314, + "MOP_CommittedPrimitiveIndex": 315, + "MOP_CommittedRayT": 316, + "MOP_CommittedStatus": 317, + "MOP_CommittedTriangleBarycentrics": 318, + "MOP_CommittedTriangleFrontFace": 319, + "MOP_CommittedWorldToObject3x4": 320, + "MOP_CommittedWorldToObject4x3": 321, + "MOP_Proceed": 322, + "MOP_RayFlags": 323, + "MOP_RayTMin": 324, + "MOP_TraceRayInline": 325, + "MOP_WorldRayDirection": 326, + "MOP_WorldRayOrigin": 327, + "MOP_Count": 328, + "MOP_FinishedCrossGroupSharing": 329, + "MOP_GetGroupNodeOutputRecords": 330, + "MOP_GetThreadNodeOutputRecords": 331, + "MOP_IsValid": 332, + "MOP_GroupIncrementOutputCount": 333, + "MOP_ThreadIncrementOutputCount": 334, + "MOP_OutputComplete": 335, + "MOP_SubpassLoad": 336, + "IOP_InterlockedUMax": 337, + "IOP_InterlockedUMin": 338, + "IOP_WaveActiveUMax": 339, + "IOP_WaveActiveUMin": 340, + "IOP_WaveActiveUProduct": 341, + "IOP_WaveActiveUSum": 342, + "IOP_WaveMultiPrefixUProduct": 343, + "IOP_WaveMultiPrefixUSum": 344, + "IOP_WavePrefixUProduct": 345, + "IOP_WavePrefixUSum": 346, + "IOP_uabs": 347, + "IOP_uclamp": 348, + "IOP_udot": 349, + "IOP_ufirstbithigh": 350, + "IOP_umad": 351, + "IOP_umax": 352, + "IOP_umin": 353, + "IOP_umul": 354, + "IOP_usign": 355, + "MOP_InterlockedUMax": 356, + "MOP_InterlockedUMin": 357 + } +} From aebbbc816ad15483d797461c2b2294896e49094c Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Fri, 21 Mar 2025 20:23:07 -0700 Subject: [PATCH 38/45] Add extended and vector overload support for DXIL --- include/dxc/DXIL/DxilConstants.h | 5 + include/dxc/DXIL/DxilOperations.h | 38 ++++++- lib/DXIL/DxilOperations.cpp | 96 ++++++++++++++++- utils/hct/hctdb.py | 165 ++++++++++++++++++++++++++---- utils/hct/hctdb_instrhelp.py | 134 +++++++++++++++++++++--- 5 files changed, 397 insertions(+), 41 deletions(-) diff --git a/include/dxc/DXIL/DxilConstants.h b/include/dxc/DXIL/DxilConstants.h index cba491ec2f..db238c99d6 100644 --- a/include/dxc/DXIL/DxilConstants.h +++ b/include/dxc/DXIL/DxilConstants.h @@ -155,6 +155,11 @@ const float kMinMipLodBias = -16.0f; const unsigned kResRetStatusIndex = 4; +/* hctdb_instrhelp.get_max_oload_dims()*/ +// OLOAD_DIMS-TEXT:BEGIN +const unsigned kDxilMaxOloadDims = 2; +// OLOAD_DIMS-TEXT:END + enum class ComponentType : uint32_t { Invalid = 0, I1, diff --git a/include/dxc/DXIL/DxilOperations.h b/include/dxc/DXIL/DxilOperations.h index a9621d0e51..955b5449db 100644 --- a/include/dxc/DXIL/DxilOperations.h +++ b/include/dxc/DXIL/DxilOperations.h @@ -58,6 +58,8 @@ class OP { void RefreshCache(); llvm::Function *GetOpFunc(OpCode OpCode, llvm::Type *pOverloadType); + llvm::Function *GetOpFunc(OpCode OpCode, + llvm::ArrayRef ExtendedOverloads); const llvm::SmallMapVector & GetOpFuncList(OpCode OpCode) const; bool IsDxilOpUsed(OpCode opcode) const; @@ -84,6 +86,10 @@ class OP { llvm::Type *GetVectorType(unsigned numElements, llvm::Type *pOverloadType); bool IsResRetType(llvm::Type *Ty); + // Construct an unnamed struct type containing the set of member types. + llvm::StructType * + GetExtendedOverloadType(llvm::ArrayRef OverloadTypes); + // Try to get the opcode class for a function. // Return true and set `opClass` if the given function is a dxil function. // Return false if the given function is not a dxil function. @@ -141,6 +147,8 @@ class OP { unsigned valMinor, unsigned &major, unsigned &minor, unsigned &mask); + static bool IsDxilOpExtendedOverload(OpCode C); + private: // Per-module properties. llvm::LLVMContext &m_Ctx; @@ -166,8 +174,9 @@ class OP { static const unsigned kUserDefineTypeSlot = 9; static const unsigned kObjectTypeSlot = 10; static const unsigned kVectorTypeSlot = 11; + static const unsigned kExtendedTypeSlot = 12; static const unsigned kNumTypeOverloads = - 12; // void, h,f,d, i1, i8,i16,i32,i64, udt, obj + 13; // void, h,f,d, i1, i8,i16,i32,i64, udt, obj, vec, extended llvm::Type *m_pResRetType[kNumTypeOverloads]; llvm::Type *m_pCBufferRetType[kNumTypeOverloads]; @@ -181,14 +190,39 @@ class OP { private: // Static properties. + struct OverloadMask { + // mask of type slot bits as (1 << TypeSlot) + uint16_t SlotMask; + static_assert(kNumTypeOverloads <= (sizeof(SlotMask) * 8)); + bool operator[](unsigned TypeSlot) const { + return (TypeSlot < kNumTypeOverloads) ? (bool)(SlotMask & (1 << TypeSlot)) + : 0; + } + operator bool() const { return SlotMask != 0; } + }; struct OpCodeProperty { OpCode opCode; const char *pOpCodeName; OpCodeClass opCodeClass; const char *pOpCodeClassName; bool bAllowOverload[kNumTypeOverloads]; // void, h,f,d, i1, i8,i16,i32,i64, - // udt, obj, vec + // udt, obj, vec, extended llvm::Attribute::AttrKind FuncAttr; + + // Extended Type Overloads: + // This is an encoding for a multi-dimensional overload. + // 1. Only bAllowOverload[kExtendedTypeSlot] is set to true + // 2. ExtendedOverloads defines allowed types for each overload index + // 3. AllowedVectorElements defines allowed vector component types, + // when kVectorTypeSlot bit is set for the corresponding overload index. + // This includes when a single vector overload type is specified with + // bAllowOverload[kVectorTypeSlot]. + + // A bit mask of allowed type slots per extended overload + OverloadMask ExtendedOverloads[DXIL::kDxilMaxOloadDims]; + // A bit mask of allowed vector element types for the vector overload + // or each corresponding extended vector overload. + OverloadMask AllowedVectorElements[DXIL::kDxilMaxOloadDims]; }; static const OpCodeProperty m_OpCodeProps[(unsigned)OpCode::NumOpCodes]; diff --git a/lib/DXIL/DxilOperations.cpp b/lib/DXIL/DxilOperations.cpp index 778130e523..afbd80f71c 100644 --- a/lib/DXIL/DxilOperations.cpp +++ b/lib/DXIL/DxilOperations.cpp @@ -3047,8 +3047,9 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { // OPCODE-OLOADS:END const char *OP::m_OverloadTypeName[kNumTypeOverloads] = { - "void", "f16", "f32", "f64", "i1", "i8", - "i16", "i32", "i64", "udt", "obj", // "udt" and "obj" should not be used + "void", "f16", "f32", "f64", "i1", "i8", "i16", + "i32", "i64", "udt", "obj", "vec", "ext", + // "udt", "obj", "vec", and "ext" should not be used }; const char *OP::m_NamePrefix = "dx.op."; @@ -3098,7 +3099,12 @@ unsigned OP::GetTypeSlot(Type *pType) { return GetTypeSlot(pType); } case Type::StructTyID: - return kObjectTypeSlot; + // Named struct value (not pointer) indicates a built-in object type. + // Anonymous struct value is used to wrap multi-overload dimensions. + if (cast(pType)->hasName()) + return kObjectTypeSlot; + else + return kExtendedTypeSlot; case Type::VectorTyID: return kVectorTypeSlot; default: @@ -3130,6 +3136,20 @@ llvm::StringRef OP::GetTypeName(Type *Ty, std::string &str) { str += std::to_string(VecTy->getNumElements()); str += GetOverloadTypeName(OP::GetTypeSlot(VecTy->getElementType())); return str; + } else if (TypeSlot == kExtendedTypeSlot) { + DXASSERT(isa(Ty), + "otherwise, extended overload type not wrapped in struct type."); + StructType *ST = cast(Ty); + DXASSERT(ST->getNumElements() <= DXIL::kDxilMaxOloadDims, + "otherwise, extended overload has too many dimensions."); + // Iterate extended slots, recurse, separate with '.' + for (unsigned I = 0; I < ST->getNumElements(); ++I) { + if (I > 0) + str += "."; + std::string TempStr; + str += GetTypeName(ST->getElementType(I), TempStr); + } + return str; } else { raw_string_ostream os(str); Ty->print(os); @@ -3177,13 +3197,43 @@ llvm::Attribute::AttrKind OP::GetMemAccessAttr(OpCode opCode) { } bool OP::IsOverloadLegal(OpCode opCode, Type *pType) { + auto &OpProps = m_OpCodeProps[static_cast(opCode)]; if (!pType) return false; if (opCode == OpCode::NumOpCodes) return false; unsigned TypeSlot = GetTypeSlot(pType); - return TypeSlot != UINT_MAX && - m_OpCodeProps[(unsigned)opCode].bAllowOverload[TypeSlot]; + if (TypeSlot >= kNumTypeOverloads) + return false; + if (!OpProps.bAllowOverload[TypeSlot]) + return false; + + if (TypeSlot == kVectorTypeSlot) { + unsigned EltTypeSlot = + GetTypeSlot(cast(pType)->getElementType()); + return OpProps.AllowedVectorElements[0][EltTypeSlot]; + } + + if (TypeSlot == kExtendedTypeSlot) { + StructType *ST = cast(pType); + if (ST->getNumElements() < 2 || + ST->getNumElements() > DXIL::kDxilMaxOloadDims) + return false; + for (unsigned I = 0; I < ST->getNumElements(); ++I) { + Type *ElTy = ST->getElementType(I); + unsigned OloadSlot = GetTypeSlot(ElTy); + if (!OpProps.ExtendedOverloads[I][OloadSlot]) + return false; + if (OloadSlot == kVectorTypeSlot) { + unsigned EltTypeSlot = + GetTypeSlot(cast(pType)->getElementType()); + if (!OpProps.AllowedVectorElements[I][EltTypeSlot]) + return false; + } + } + return true; + } + return true; } bool OP::CheckOpCodeTable() { @@ -3331,6 +3381,13 @@ bool OP::IsDxilOpBarrier(OpCode C) { // OPCODE-BARRIER:END } +bool OP::IsDxilOpExtendedOverload(OpCode C) { + if (C >= OpCode::NumOpCodes) + return false; + return m_OpCodeProps[static_cast(C)] + .bAllowOverload[kExtendedTypeSlot]; +} + static unsigned MaskMemoryTypeFlagsIfAllowed(unsigned memoryTypeFlags, unsigned allowedMask) { // If the memory type is AllMemory, masking inapplicable flags is allowed. @@ -3969,6 +4026,8 @@ void OP::FixOverloadNames() { if (F.isDeclaration() && OP::IsDxilOpFunc(&F) && !F.user_empty()) { CallInst *CI = cast(*F.user_begin()); DXIL::OpCode opCode = OP::GetDxilOpFuncCallInst(CI); + if (IsDxilOpExtendedOverload(opCode)) + continue; llvm::Type *Ty = OP::GetOverloadType(opCode, &F); if (!OP::IsOverloadLegal(opCode, Ty)) continue; @@ -3988,11 +4047,31 @@ void OP::UpdateCache(OpCodeClass opClass, Type *Ty, llvm::Function *F) { m_FunctionToOpClass[F] = opClass; } +Function *OP::GetOpFunc(OpCode opCode, ArrayRef ExtendedOverloads) { + DXASSERT(IsDxilOpExtendedOverload(opCode), + "otherwise, Dxil Op does not support extended overload"); + return GetOpFunc(opCode, GetExtendedOverloadType(ExtendedOverloads)); +} + Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { if (opCode == OpCode::NumOpCodes) return nullptr; if (!pOverloadType) return nullptr; + if (IsDxilOpExtendedOverload(opCode)) { + StructType *ST = dyn_cast(pOverloadType); + DXASSERT(ST != nullptr, + "otherwise, extended overload type is not a struct"); + if (ST == nullptr) + return nullptr; + bool EltCountValid = ST->getNumElements() > 1 && + ST->getNumElements() <= DXIL::kDxilMaxOloadDims; + DXASSERT(EltCountValid, + "otherwise, invalid type count for extended overload."); + if (!EltCountValid) + return nullptr; + } + // Illegal overloads are generated and eliminated by DXIL op constant // evaluation for a number of cases where a double overload of an HL intrinsic // that otherwise does not support double is used for literal values, when @@ -4045,6 +4124,9 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { #define CBRT(_y) A(GetCBufferRetType(_y)) #define VEC4(_y) A(GetVectorType(4, _y)) +// Extended Overload types are wrapped in an anonymous struct +#define EXT(_y) A(cast(pOverloadType)->getElementType(_y)) + /* hctdb_instrhelp.get_oloads_funcs()*/ switch (opCode) { // return opCode // OPCODE-OLOAD-FUNCS:BEGIN @@ -6595,6 +6677,10 @@ Type *OP::GetVectorType(unsigned numElements, Type *pOverloadType) { return nullptr; } +StructType *OP::GetExtendedOverloadType(ArrayRef OverloadTypes) { + return StructType::get(m_Ctx, OverloadTypes); +} + //------------------------------------------------------------------------------ // // LLVM utility methods. diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 3759849ebe..989e93e367 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -37,6 +37,32 @@ "array_local_ldst", ] +# These are the valid overload type characters for DXIL instructions. +# - "v" is for void, and is mutually exclusive with the other types. +# - "u" is for user defined type (UDT), and is mutually exclusive with the other +# types. +# - "o" is for an HLSL object type (e.g. Texture, Sampler, etc.), and is +# mutually exclusive with the other types. +# - "<" is for vector overloads, and may be followed by a set of supported +# component types. +# - If "<" is not followed by any component types, any preceding scalar types +# are used. +# - Vector component types are captured into a separate list during +# processing. +# - "x" is for extended overloads, in order to support multiple overload +# dimensions, and is mutually exclusive with the other types. +# - "x" is not supplied manually, but automatically used when processing +# overloads that use "," to separate multiple overload dimensions, which are +# captured into a separate list. +# - "," is used to separate multiple overload dimensions, will be converted +# to a use of a single "x" overload string during processing. +dxil_all_user_oload_chars = "vhfd18wiluo<," +dxil_scalar_oload_chars = "hfd18wil" + +# Maximum number of overload dimensions supported through the extended overload +# in DXIL instructions. +dxil_max_overload_dims = 2 + class db_dxil_enum_value(object): "A representation for a value in an enumeration type" @@ -81,6 +107,8 @@ def __init__(self, name, **kwargs): self.ops = [] # the operands that this instruction takes self.is_allowed = True # whether this instruction is allowed in a DXIL program self.oload_types = "" # overload types if applicable + self.extended_oload_types = None # extended overload types if applicable + self.vector_oload_types = None # vector overload types if applicable self.fn_attr = "" # attribute shorthands: rn=does not access memory,ro=only reads from memory, self.is_deriv = False # whether this is some kind of derivative self.is_gradient = False # whether this requires a gradient calculation @@ -98,6 +126,8 @@ def __init__(self, name, **kwargs): self.is_reserved = self.dxil_class == "Reserved" self.shader_model_translated = () # minimum shader model required with translation by linker self.props = {} # extra properties + if self.is_dxil_op: + self.process_oload_types() def __str__(self): return self.name @@ -105,6 +135,120 @@ def __str__(self): def fully_qualified_name(self): return "{}::{}".format(self.fully_qualified_name_prefix, self.name) + def process_oload_types(self): + if type(self.oload_types) is not str: + raise ValueError( + f"overload for '{self.name}' should be a string - use empty if n/a" + ) + # Early out for LLVM instructions or void overloads. + if self.oload_types == "v" or not self.is_dxil_op: + return + + if self.oload_types == "": + raise ValueError( + f"overload for '{self.name}' should not be empty - use void if n/a" + ) + if "v" in self.oload_types: + raise ValueError( + f"void overload should be exclusive to other types for '({self.name})'" + ) + + # Process oload_types for extended and vector overloads. + # Contrived example: "hf<, dxil_max_overload_dims: + raise ValueError( + "Too many overload dimensions for DXIL op " + f"{self.name}: '{self.oload_types}'" + ) + self.vector_oload_types = [""] * len(oload_types) + for n, oloads in enumerate(oload_types): + if len(oloads) == 0: + raise ValueError( + f"Invalid extended overload type syntax for DXIL op " + f"{self.name}: '{self.oload_types}'" + ) + # split at vector for component overloads, if vector specified + # without following components, use the scalar overloads that + # precede the vector character. + split = oloads.split("<") + if len(split) == 1: + # No vector overload. + continue + elif len(split) != 2: + raise ValueError( + f"Invalid overload types for DXIL op {self.name}: " + f"{self.oload_types}" + ) + + # Split into scalar and vector component overloads. + scalars, vector_oloads = split + if not vector_oloads: + vector_oloads = scalars + if not vector_oloads: + raise ValueError( + "No scalar overload types provided with vector overload " + f"for DXIL op {self.name}: '{self.oload_types}'" + ) + for c in scalars: + if c not in dxil_scalar_oload_chars: + raise ValueError( + "Invalid overload type character used with vector for " + f"DXIL op {self.name}: {c} in '{self.oload_types}'" + ) + oload_types[n] = scalars + "<" + self.vector_oload_types[n] = vector_oloads + if len(oload_types) > 1: + self.oload_types = "x" + self.extended_oload_types = oload_types + self.check_extended_oload_ops() + else: + self.oload_types = oload_types[0] + self.extended_oload_types = None + + def check_extended_oload_ops(self): + "Ensure ops has sequential extended overload references with $x0, $x1, etc." + next_oload_idx = 0 + for i in self.ops: + if i.llvm_type.startswith("$x"): + if i.llvm_type != "$x" + str(next_oload_idx): + raise ValueError( + "Extended overloads are not sequentially referenced in " + f"DXIL op {self.name}: {i.llvm_type} != $x{next_oload_idx}" + ) + next_oload_idx += 1 + if next_oload_idx != len(self.extended_oload_types): + raise ValueError( + "Extended overloads are not referenced for all overload " + f"dimensions in DXIL op {self.name}: {next_oload_idx} != " + f"{len(self.extended_oload_types)}" + ) + class db_dxil_metadata(object): "A representation for a metadata record" @@ -477,9 +621,7 @@ def populate_categories_and_models(self): "closesthit", ) for i in "GeometryIndex".split(","): - self.name_idx[ - i - ].category = ( + self.name_idx[i].category = ( "Raytracing object space uint System Values, raytracing tier 1.1" ) self.name_idx[i].shader_model = 6, 5 @@ -574,9 +716,7 @@ def populate_categories_and_models(self): self.name_idx[i].shader_model = 6, 3 self.name_idx[i].shader_stages = ("library", "intersection") for i in "CreateHandleForLib".split(","): - self.name_idx[ - i - ].category = ( + self.name_idx[i].category = ( "Library create handle from resource struct (like HL intrinsic)" ) self.name_idx[i].shader_model = 6, 3 @@ -5687,18 +5827,6 @@ def UFI(name, **mappings): ) for i in self.instr: self.verify_dense(i.ops, lambda x: x.pos, lambda x: i.name) - for i in self.instr: - if i.is_dxil_op: - assert i.oload_types != "", ( - "overload for DXIL operation %s should not be empty - use void if n/a" - % (i.name) - ) - assert i.oload_types == "v" or i.oload_types.find("v") < 0, ( - "void overload should be exclusive to other types (%s)" % i.name - ) - assert ( - type(i.oload_types) is str - ), "overload for %s should be a string - use empty if n/a" % (i.name) # Verify that all operations in each class have the same signature. import itertools @@ -8401,6 +8529,7 @@ def __init__( self.template_id_idx = template_id_idx # Template ID numeric value self.component_id_idx = component_id_idx # Component ID numeric value + class db_hlsl(object): "A database of HLSL language data" diff --git a/utils/hct/hctdb_instrhelp.py b/utils/hct/hctdb_instrhelp.py index 680cfd6923..03e8be9e93 100644 --- a/utils/hct/hctdb_instrhelp.py +++ b/utils/hct/hctdb_instrhelp.py @@ -40,8 +40,10 @@ def get_hlsl_opcode_data(): g_hlsl_opcode_data = {} return g_hlsl_opcode_data + g_db_hlsl = None + def get_db_hlsl(): global g_db_hlsl if g_db_hlsl is None: @@ -51,6 +53,11 @@ def get_db_hlsl(): return g_db_hlsl +def get_max_oload_dims(): + db = get_db_dxil() + return f"const unsigned kDxilMaxOloadDims = {dxil_max_overload_dims};" + + def format_comment(prefix, val): "Formats a value with a line-comment prefix." result = "" @@ -508,25 +515,23 @@ def print_opfunc_props(self): ) ) print( - "// OpCode OpCode name, OpCodeClass OpCodeClass name, void, h, f, d, i1, i8, i16, i32, i64, udt, obj, vec, function attribute" + "// OpCode OpCode name, OpCodeClass OpCodeClass name, void, h, f, d, i1, i8, i16, i32, i64, udt, obj, vec, ext, function attribute, ext oload, vec oload" ) # Example formatted string: - # { OC::TempRegLoad, "TempRegLoad", OCC::TempRegLoad, "tempRegLoad", false, true, true, false, true, false, true, true, false, Attribute::ReadOnly, }, - # 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 - # 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 + # { OC::TempRegLoad, "TempRegLoad", OCC::TempRegLoad, "tempRegLoad", false, true, true, false, true, false, true, true, false, false, false, false, false, Attribute::ReadOnly, {}, {0x00} }, + # 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 + # 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 last_category = None - # overload types are a string of (v)oid, (h)alf, (f)loat, (d)ouble, (1)-bit, (8)-bit, (w)ord, (i)nt, (l)ong, u(dt), o(bj), vec(t)or + # overload types are a string of (v)oid, (h)alf, (f)loat, (d)ouble, (1)-bit, (8)-bit, (w)ord, (i)nt, (l)ong, u(dt), o(bj), vec(t)or, e(x)tended f = lambda i, c: "true" if i.oload_types.find(c) >= 0 else "false" lower_exceptions = { "CBufferLoad": "cbufferLoad", "CBufferLoadLegacy": "cbufferLoadLegacy", "GSInstanceID": "gsInstanceID", } - lower_fn = ( - lambda t: lower_exceptions[t] - if t in lower_exceptions - else t[:1].lower() + t[1:] + lower_fn = lambda t: ( + lower_exceptions[t] if t in lower_exceptions else t[:1].lower() + t[1:] ) attr_dict = { "": "None", @@ -537,19 +542,48 @@ def print_opfunc_props(self): "nr": "NoReturn", "wv": "None", } - attr_fn = lambda i: "Attribute::" + attr_dict[i.fn_attr] + "," + attr_fn = lambda i: "Attribute::" + attr_dict[i.fn_attr] + oload_to_mask = lambda oload: sum( + [1 << dxil_all_user_oload_chars.find(c) for c in oload] + ) + maybe_oloads_fn = lambda oloads: oloads if oloads else [] + ext_oload_fn = ( + lambda i: "{" + + ",".join( + [ + "0x%02x" % oload_to_mask(o) + for o in maybe_oloads_fn(i.extended_oload_types) + ] + ) + + "}" + ) + vec_oload_fn = ( + lambda i: "{" + + ",".join( + [ + "0x%02x" % oload_to_mask(o) + for o in maybe_oloads_fn(i.vector_oload_types) + ] + ) + + "}" + ) for i in self.instrs: if last_category != i.category: if last_category != None: print("") print( - " // {category:118} void, h, f, d, i1, i8, i16, i32, i64, udt, obj, vec, function attribute".format( + " // {category:118} void, h, f, d, i1, i8, i16, i32, i64, udt, obj, vec, function attribute, ext oload, vec oload".format( category=i.category ) ) last_category = i.category print( - " {{ {OC}::{name:24} {quotName:27} {OCC}::{className:25} {classNameQuot:28} {{{v:>6},{h:>6},{f:>6},{d:>6},{b:>6},{e:>6},{w:>6},{i:>6},{l:>6},{u:>6},{o:>6},{t:>6}}}, {attr:20} }},".format( + ( + " {{ {OC}::{name:24} {quotName:27} {OCC}::{className:25} " + + "{classNameQuot:28} {{{v:>6},{h:>6},{f:>6},{d:>6},{b:>6}," + + "{e:>6},{w:>6},{i:>6},{l:>6},{u:>6},{o:>6},{t:>6}," + + "{x:>6}}}, {attr:20}, {ext_oload:2}, {vec_oload:6} }}," + ).format( name=i.name + ",", quotName='"' + i.name + '",', className=i.dxil_class + ",", @@ -565,10 +599,13 @@ def print_opfunc_props(self): l=f(i, "l"), u=f(i, "u"), o=f(i, "o"), - t=f(i, "t"), + t=f(i, "<"), + x=f(i, "x"), attr=attr_fn(i), OC=self.OC, OCC=self.OCC, + ext_oload=ext_oload_fn(i), + vec_oload=vec_oload_fn(i), ) ) print("};") @@ -621,6 +658,9 @@ def print_opfunc_table(self): "noderecordhandle": "A(pNodeRecordHandle);", "nodeproperty": "A(nodeProperty);", "noderecordproperty": "A(nodeRecordProperty);", + # Extended overload slots, extend as needed: + "$x0": "EXT(0);", + "$x1": "EXT(1);", } last_category = None for i in self.instrs: @@ -651,12 +691,15 @@ def print_opfunc_oload_type(self): obj_ty = "obj" vec_ty = "$vec" gsptr_ty = "$gsptr" + extended_ty = "$x" last_category = None index_dict = collections.OrderedDict() ptr_index_dict = collections.OrderedDict() single_dict = collections.OrderedDict() + extended_dict = collections.OrderedDict() struct_list = [] + extended_list = [] for instr in self.instrs: ret_ty = instr.ops[0].llvm_type @@ -676,6 +719,10 @@ def print_opfunc_oload_type(self): struct_list.append(instr.name) continue + if instr.oload_types == "x": + extended_list.append(instr) + continue + in_param_ty = False # Try to find elt_ty in parameter types. for index, op in enumerate(instr.ops): @@ -730,9 +777,7 @@ def print_opfunc_oload_type(self): "i": "IntegerType::get(Ctx, 32)", "l": "IntegerType::get(Ctx, 64)", "v": "Type::getVoidTy(Ctx)", - "u": "Type::getInt32PtrTy(Ctx)", - "o": "Type::getInt32PtrTy(Ctx)", - "t": "Type::getInt32PtrTy(Ctx)", + # No other types should be referenced here. } assert ty in type_code_texts, "llvm type %s is unknown" % (ty) ty_code = type_code_texts[ty] @@ -792,6 +837,61 @@ def print_opfunc_oload_type(self): line = line + "}" print(line) + for instr in extended_list: + # Collect indices for overloaded return and types, make a tuple of + # indices the key, and add the opcode to a list of opcodes for that + # key. Indices start with 0 for return type, and 1 for the first + # function parameter, which is the DXIL OpCode. + indices = [] + for index, op in enumerate(instr.ops): + # Skip dxil opcode. + if op.pos == 1: + continue + + op_type = op.llvm_type + if op_type.startswith(extended_ty): + try: + extended_index = int(op_type[2:]) + except: + raise ValueError( + "Error parsing extended operand type " + + f"'{op_type}' for DXIL op '{instr.name}'" + ) + if extended_index != len(indices): + raise ValueError( + f"'$x{extended_index}' is not in sequential " + + f"order for DXIL op '{instr.name}'" + ) + indices.append(op.pos) + + if len(indices) != len(instr.extended_oload_types): + raise ValueError( + f"DXIL op {instr.name}: extended overload count " + + "mismatches the number of overload types" + ) + extended_dict.setdefault(tuple(indices), []).append(instr.name) + + def GetTypeAtIndex(index): + if index == 0: + return "FT->getReturnType()" + return f"FT->getParamType({index - 1})" + + for index_tuple, opcodes in extended_dict.items(): + line = "" + for opcode in opcodes: + line = line + f"case OpCode::{opcode}:\n" + if index_tuple[-1] > 0: + line += ( + f" if (FT->getNumParams() < {index_tuple[-1]})\n" + + " return nullptr;\n" + ) + line += ( + " return llvm::StructType::get(Ctx, {" + + ", ".join([GetTypeAtIndex(index) for index in index_tuple]) + + "});\n" + ) + print(line) + class db_valfns_gen: "A generator of validation functions." @@ -1593,6 +1693,7 @@ def get_highest_released_shader_model(): ) return result + def get_highest_shader_model(): result = """static const unsigned kHighestMajor = %d; static const unsigned kHighestMinor = %d;""" % ( @@ -1601,6 +1702,7 @@ def get_highest_shader_model(): ) return result + def get_dxil_version_minor(): return "const unsigned kDxilMinor = %d;" % highest_minor From b06f5f4c75ef610ee9b1a2b04774f3782c67023b Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Tue, 25 Mar 2025 17:59:46 -0600 Subject: [PATCH 39/45] update intrinsics to new vector param notation --- utils/hct/hctdb.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 989e93e367..05f45600f2 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -1519,7 +1519,7 @@ def UFI(name, **mappings): next_op_idx, "Unary", "returns the " + i, - "hf", + "hf<", "rn", [ db_dxil_param(0, "$o", "", "operation result"), @@ -1583,7 +1583,7 @@ def UFI(name, **mappings): next_op_idx, "Binary", "returns the " + i + " of the input values", - "hfdt", + "hfd<", "rn", [ db_dxil_param(0, "$o", "", "operation result"), @@ -1601,7 +1601,7 @@ def UFI(name, **mappings): next_op_idx, "Binary", "returns the " + i + " of the input values", - "wilt", + "wil<", "rn", [ db_dxil_param(0, "$o", "", "operation result"), @@ -1673,7 +1673,7 @@ def UFI(name, **mappings): next_op_idx, "Tertiary", "performs a fused multiply add (FMA) of the form a * b + c", - "dt", + "d<", "rn", [ db_dxil_param( @@ -5732,7 +5732,7 @@ def UFI(name, **mappings): next_op_idx, "RawBufferVectorLoad", "reads from a raw buffer and structured buffer", - "t", + "hfwidl<", "ro", [ db_dxil_param(0, "$r", "", "the loaded value"), @@ -5766,7 +5766,7 @@ def UFI(name, **mappings): next_op_idx, "RawBufferVectorStore", "writes to a RWByteAddressBuffer or RWStructuredBuffer", - "t", + "hfwidl<", "", [ db_dxil_param(0, "v", "", ""), @@ -5817,9 +5817,6 @@ def UFI(name, **mappings): ), "all derivatives are marked as requiring gradients" self.name_idx[i].is_deriv = True - for i in "Atan,Htan,Exp,Log".split(","): - self.name_idx[i].oload_types = "hft" - # TODO - some arguments are required to be immediate constants in DXIL, eg resource kinds; add this information # consider - report instructions that are overloaded on a single type, then turn them into non-overloaded version of that type self.verify_dense( From 4e943883825926735c0688da98088236f6546264 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Tue, 25 Mar 2025 18:00:04 -0600 Subject: [PATCH 40/45] regenerate dxiloperations --- lib/DXIL/DxilOperations.cpp | 5693 ++++++++++++++++++----------------- 1 file changed, 2860 insertions(+), 2833 deletions(-) diff --git a/lib/DXIL/DxilOperations.cpp b/lib/DXIL/DxilOperations.cpp index afbd80f71c..41c3d21e2b 100644 --- a/lib/DXIL/DxilOperations.cpp +++ b/lib/DXIL/DxilOperations.cpp @@ -43,3006 +43,3033 @@ import hctdb_instrhelp const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { // OpCode OpCode name, OpCodeClass // OpCodeClass name, void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj, vec, function attribute + // i16, i32, i64, udt, obj, vec, ext, function attribute, ext + // oload, vec oload // Temporary, indexable, input, output registers void, h, f, d, - // i1, i8, i16, i32, i64, udt, obj, vec, function attribute - { - OC::TempRegLoad, - "TempRegLoad", - OCC::TempRegLoad, - "tempRegLoad", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::TempRegStore, - "TempRegStore", - OCC::TempRegStore, - "tempRegStore", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::None, - }, - { - OC::MinPrecXRegLoad, - "MinPrecXRegLoad", - OCC::MinPrecXRegLoad, - "minPrecXRegLoad", - {false, true, false, false, false, false, true, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::MinPrecXRegStore, - "MinPrecXRegStore", - OCC::MinPrecXRegStore, - "minPrecXRegStore", - {false, true, false, false, false, false, true, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::LoadInput, - "LoadInput", - OCC::LoadInput, - "loadInput", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::StoreOutput, - "StoreOutput", - OCC::StoreOutput, - "storeOutput", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::None, - }, + // i1, i8, i16, i32, i64, udt, obj, vec, function attribute, + // ext oload, vec oload + {OC::TempRegLoad, + "TempRegLoad", + OCC::TempRegLoad, + "tempRegLoad", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::TempRegStore, + "TempRegStore", + OCC::TempRegStore, + "tempRegStore", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, + {OC::MinPrecXRegLoad, + "MinPrecXRegLoad", + OCC::MinPrecXRegLoad, + "minPrecXRegLoad", + {false, true, false, false, false, false, true, false, false, false, false, + false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::MinPrecXRegStore, + "MinPrecXRegStore", + OCC::MinPrecXRegStore, + "minPrecXRegStore", + {false, true, false, false, false, false, true, false, false, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, + {OC::LoadInput, + "LoadInput", + OCC::LoadInput, + "loadInput", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::StoreOutput, + "StoreOutput", + OCC::StoreOutput, + "storeOutput", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, // Unary float void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::FAbs, - "FAbs", - OCC::Unary, - "unary", - {false, true, true, true, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Saturate, - "Saturate", - OCC::Unary, - "unary", - {false, true, true, true, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::IsNaN, - "IsNaN", - OCC::IsSpecialFloat, - "isSpecialFloat", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::IsInf, - "IsInf", - OCC::IsSpecialFloat, - "isSpecialFloat", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::IsFinite, - "IsFinite", - OCC::IsSpecialFloat, - "isSpecialFloat", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::IsNormal, - "IsNormal", - OCC::IsSpecialFloat, - "isSpecialFloat", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Cos, - "Cos", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Sin, - "Sin", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Tan, - "Tan", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Acos, - "Acos", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Asin, - "Asin", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Atan, - "Atan", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, true}, - Attribute::ReadNone, - }, - { - OC::Hcos, - "Hcos", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Hsin, - "Hsin", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Htan, - "Htan", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, true}, - Attribute::ReadNone, - }, - { - OC::Exp, - "Exp", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, true}, - Attribute::ReadNone, - }, - { - OC::Frc, - "Frc", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Log, - "Log", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, true}, - Attribute::ReadNone, - }, - { - OC::Sqrt, - "Sqrt", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Rsqrt, - "Rsqrt", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::FAbs, + "FAbs", + OCC::Unary, + "unary", + {false, true, true, true, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::Saturate, + "Saturate", + OCC::Unary, + "unary", + {false, true, true, true, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::IsNaN, + "IsNaN", + OCC::IsSpecialFloat, + "isSpecialFloat", + {false, true, true, false, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::IsInf, + "IsInf", + OCC::IsSpecialFloat, + "isSpecialFloat", + {false, true, true, false, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::IsFinite, + "IsFinite", + OCC::IsSpecialFloat, + "isSpecialFloat", + {false, true, true, false, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::IsNormal, + "IsNormal", + OCC::IsSpecialFloat, + "isSpecialFloat", + {false, true, true, false, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::Cos, + "Cos", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x06}}, + {OC::Sin, + "Sin", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x06}}, + {OC::Tan, + "Tan", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x06}}, + {OC::Acos, + "Acos", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x06}}, + {OC::Asin, + "Asin", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x06}}, + {OC::Atan, + "Atan", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x06}}, + {OC::Hcos, + "Hcos", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x06}}, + {OC::Hsin, + "Hsin", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x06}}, + {OC::Htan, + "Htan", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x06}}, + {OC::Exp, + "Exp", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x06}}, + {OC::Frc, + "Frc", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x06}}, + {OC::Log, + "Log", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x06}}, + {OC::Sqrt, + "Sqrt", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x06}}, + {OC::Rsqrt, + "Rsqrt", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x06}}, // Unary float - rounding void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj, vec, function attribute - { - OC::Round_ne, - "Round_ne", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Round_ni, - "Round_ni", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Round_pi, - "Round_pi", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Round_z, - "Round_z", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, + // i32, i64, udt, obj, vec, function attribute, ext oload, vec + // oload + {OC::Round_ne, + "Round_ne", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x06}}, + {OC::Round_ni, + "Round_ni", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x06}}, + {OC::Round_pi, + "Round_pi", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x06}}, + {OC::Round_z, + "Round_z", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x06}}, // Unary int void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::Bfrev, - "Bfrev", - OCC::Unary, - "unary", - {false, false, false, false, false, false, true, true, true, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Countbits, - "Countbits", - OCC::UnaryBits, - "unaryBits", - {false, false, false, false, false, false, true, true, true, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::FirstbitLo, - "FirstbitLo", - OCC::UnaryBits, - "unaryBits", - {false, false, false, false, false, false, true, true, true, false, - false, false}, - Attribute::ReadNone, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::Bfrev, + "Bfrev", + OCC::Unary, + "unary", + {false, false, false, false, false, false, true, true, true, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::Countbits, + "Countbits", + OCC::UnaryBits, + "unaryBits", + {false, false, false, false, false, false, true, true, true, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::FirstbitLo, + "FirstbitLo", + OCC::UnaryBits, + "unaryBits", + {false, false, false, false, false, false, true, true, true, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Unary uint void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::FirstbitHi, - "FirstbitHi", - OCC::UnaryBits, - "unaryBits", - {false, false, false, false, false, false, true, true, true, false, - false, false}, - Attribute::ReadNone, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::FirstbitHi, + "FirstbitHi", + OCC::UnaryBits, + "unaryBits", + {false, false, false, false, false, false, true, true, true, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Unary int void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::FirstbitSHi, - "FirstbitSHi", - OCC::UnaryBits, - "unaryBits", - {false, false, false, false, false, false, true, true, true, false, - false, false}, - Attribute::ReadNone, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::FirstbitSHi, + "FirstbitSHi", + OCC::UnaryBits, + "unaryBits", + {false, false, false, false, false, false, true, true, true, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Binary float void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::FMax, - "FMax", - OCC::Binary, - "binary", - {false, true, true, true, false, false, false, false, false, false, - false, true}, - Attribute::ReadNone, - }, - { - OC::FMin, - "FMin", - OCC::Binary, - "binary", - {false, true, true, true, false, false, false, false, false, false, - false, true}, - Attribute::ReadNone, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::FMax, + "FMax", + OCC::Binary, + "binary", + {false, true, true, true, false, false, false, false, false, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x0e}}, + {OC::FMin, + "FMin", + OCC::Binary, + "binary", + {false, true, true, true, false, false, false, false, false, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x0e}}, // Binary int void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::IMax, - "IMax", - OCC::Binary, - "binary", - {false, false, false, false, false, false, true, true, true, false, - false, true}, - Attribute::ReadNone, - }, - { - OC::IMin, - "IMin", - OCC::Binary, - "binary", - {false, false, false, false, false, false, true, true, true, false, - false, true}, - Attribute::ReadNone, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::IMax, + "IMax", + OCC::Binary, + "binary", + {false, false, false, false, false, false, true, true, true, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x1c0}}, + {OC::IMin, + "IMin", + OCC::Binary, + "binary", + {false, false, false, false, false, false, true, true, true, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x1c0}}, // Binary uint void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::UMax, - "UMax", - OCC::Binary, - "binary", - {false, false, false, false, false, false, true, true, true, false, - false, true}, - Attribute::ReadNone, - }, - { - OC::UMin, - "UMin", - OCC::Binary, - "binary", - {false, false, false, false, false, false, true, true, true, false, - false, true}, - Attribute::ReadNone, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::UMax, + "UMax", + OCC::Binary, + "binary", + {false, false, false, false, false, false, true, true, true, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x1c0}}, + {OC::UMin, + "UMin", + OCC::Binary, + "binary", + {false, false, false, false, false, false, true, true, true, false, false, + true, false}, + Attribute::ReadNone, + {}, + {0x1c0}}, // Binary int with two outputs void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj, vec, function attribute - { - OC::IMul, - "IMul", - OCC::BinaryWithTwoOuts, - "binaryWithTwoOuts", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // i32, i64, udt, obj, vec, function attribute, ext oload, vec + // oload + {OC::IMul, + "IMul", + OCC::BinaryWithTwoOuts, + "binaryWithTwoOuts", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Binary uint with two outputs void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj, vec, function attribute - { - OC::UMul, - "UMul", - OCC::BinaryWithTwoOuts, - "binaryWithTwoOuts", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::UDiv, - "UDiv", - OCC::BinaryWithTwoOuts, - "binaryWithTwoOuts", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // i16, i32, i64, udt, obj, vec, function attribute, ext oload, + // vec oload + {OC::UMul, + "UMul", + OCC::BinaryWithTwoOuts, + "binaryWithTwoOuts", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::UDiv, + "UDiv", + OCC::BinaryWithTwoOuts, + "binaryWithTwoOuts", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Binary uint with carry or borrow void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj, vec, function attribute - { - OC::UAddc, - "UAddc", - OCC::BinaryWithCarryOrBorrow, - "binaryWithCarryOrBorrow", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::USubb, - "USubb", - OCC::BinaryWithCarryOrBorrow, - "binaryWithCarryOrBorrow", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // i16, i32, i64, udt, obj, vec, function attribute, ext oload, + // vec oload + {OC::UAddc, + "UAddc", + OCC::BinaryWithCarryOrBorrow, + "binaryWithCarryOrBorrow", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::USubb, + "USubb", + OCC::BinaryWithCarryOrBorrow, + "binaryWithCarryOrBorrow", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Tertiary float void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::FMad, - "FMad", - OCC::Tertiary, - "tertiary", - {false, true, true, true, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Fma, - "Fma", - OCC::Tertiary, - "tertiary", - {false, false, false, true, false, false, false, false, false, false, - false, true}, - Attribute::ReadNone, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::FMad, + "FMad", + OCC::Tertiary, + "tertiary", + {false, true, true, true, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::Fma, + "Fma", + OCC::Tertiary, + "tertiary", + {false, false, false, true, false, false, false, false, false, false, + false, true, false}, + Attribute::ReadNone, + {}, + {0x08}}, // Tertiary int void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::IMad, - "IMad", - OCC::Tertiary, - "tertiary", - {false, false, false, false, false, false, true, true, true, false, - false, false}, - Attribute::ReadNone, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::IMad, + "IMad", + OCC::Tertiary, + "tertiary", + {false, false, false, false, false, false, true, true, true, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Tertiary uint void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::UMad, - "UMad", - OCC::Tertiary, - "tertiary", - {false, false, false, false, false, false, true, true, true, false, - false, false}, - Attribute::ReadNone, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::UMad, + "UMad", + OCC::Tertiary, + "tertiary", + {false, false, false, false, false, false, true, true, true, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Tertiary int void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::Msad, - "Msad", - OCC::Tertiary, - "tertiary", - {false, false, false, false, false, false, false, true, true, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Ibfe, - "Ibfe", - OCC::Tertiary, - "tertiary", - {false, false, false, false, false, false, false, true, true, false, - false, false}, - Attribute::ReadNone, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::Msad, + "Msad", + OCC::Tertiary, + "tertiary", + {false, false, false, false, false, false, false, true, true, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::Ibfe, + "Ibfe", + OCC::Tertiary, + "tertiary", + {false, false, false, false, false, false, false, true, true, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Tertiary uint void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::Ubfe, - "Ubfe", - OCC::Tertiary, - "tertiary", - {false, false, false, false, false, false, false, true, true, false, - false, false}, - Attribute::ReadNone, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::Ubfe, + "Ubfe", + OCC::Tertiary, + "tertiary", + {false, false, false, false, false, false, false, true, true, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Quaternary void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::Bfi, - "Bfi", - OCC::Quaternary, - "quaternary", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::Bfi, + "Bfi", + OCC::Quaternary, + "quaternary", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Dot void, h, f, d, i1, i8, i16, i32, i64, udt, - // obj, vec, function attribute - { - OC::Dot2, - "Dot2", - OCC::Dot2, - "dot2", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Dot3, - "Dot3", - OCC::Dot3, - "dot3", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Dot4, - "Dot4", - OCC::Dot4, - "dot4", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, + // obj, vec, function attribute, ext oload, vec oload + {OC::Dot2, + "Dot2", + OCC::Dot2, + "dot2", + {false, true, true, false, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::Dot3, + "Dot3", + OCC::Dot3, + "dot3", + {false, true, true, false, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::Dot4, + "Dot4", + OCC::Dot4, + "dot4", + {false, true, true, false, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Resources void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::CreateHandle, - "CreateHandle", - OCC::CreateHandle, - "createHandle", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::CBufferLoad, - "CBufferLoad", - OCC::CBufferLoad, - "cbufferLoad", - {false, true, true, true, false, true, true, true, true, false, false, - false}, - Attribute::ReadOnly, - }, - { - OC::CBufferLoadLegacy, - "CBufferLoadLegacy", - OCC::CBufferLoadLegacy, - "cbufferLoadLegacy", - {false, true, true, true, false, false, true, true, true, false, false, - false}, - Attribute::ReadOnly, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::CreateHandle, + "CreateHandle", + OCC::CreateHandle, + "createHandle", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {}}, + {OC::CBufferLoad, + "CBufferLoad", + OCC::CBufferLoad, + "cbufferLoad", + {false, true, true, true, false, true, true, true, true, false, false, + false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::CBufferLoadLegacy, + "CBufferLoadLegacy", + OCC::CBufferLoadLegacy, + "cbufferLoadLegacy", + {false, true, true, true, false, false, true, true, true, false, false, + false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, // Resources - sample void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::Sample, - "Sample", - OCC::Sample, - "sample", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::SampleBias, - "SampleBias", - OCC::SampleBias, - "sampleBias", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::SampleLevel, - "SampleLevel", - OCC::SampleLevel, - "sampleLevel", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::SampleGrad, - "SampleGrad", - OCC::SampleGrad, - "sampleGrad", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::SampleCmp, - "SampleCmp", - OCC::SampleCmp, - "sampleCmp", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::SampleCmpLevelZero, - "SampleCmpLevelZero", - OCC::SampleCmpLevelZero, - "sampleCmpLevelZero", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::Sample, + "Sample", + OCC::Sample, + "sample", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::SampleBias, + "SampleBias", + OCC::SampleBias, + "sampleBias", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::SampleLevel, + "SampleLevel", + OCC::SampleLevel, + "sampleLevel", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::SampleGrad, + "SampleGrad", + OCC::SampleGrad, + "sampleGrad", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::SampleCmp, + "SampleCmp", + OCC::SampleCmp, + "sampleCmp", + {false, true, true, false, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::SampleCmpLevelZero, + "SampleCmpLevelZero", + OCC::SampleCmpLevelZero, + "sampleCmpLevelZero", + {false, true, true, false, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, // Resources void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::TextureLoad, - "TextureLoad", - OCC::TextureLoad, - "textureLoad", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::TextureStore, - "TextureStore", - OCC::TextureStore, - "textureStore", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::None, - }, - { - OC::BufferLoad, - "BufferLoad", - OCC::BufferLoad, - "bufferLoad", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::BufferStore, - "BufferStore", - OCC::BufferStore, - "bufferStore", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::None, - }, - { - OC::BufferUpdateCounter, - "BufferUpdateCounter", - OCC::BufferUpdateCounter, - "bufferUpdateCounter", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::CheckAccessFullyMapped, - "CheckAccessFullyMapped", - OCC::CheckAccessFullyMapped, - "checkAccessFullyMapped", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::GetDimensions, - "GetDimensions", - OCC::GetDimensions, - "getDimensions", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::TextureLoad, + "TextureLoad", + OCC::TextureLoad, + "textureLoad", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::TextureStore, + "TextureStore", + OCC::TextureStore, + "textureStore", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, + {OC::BufferLoad, + "BufferLoad", + OCC::BufferLoad, + "bufferLoad", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::BufferStore, + "BufferStore", + OCC::BufferStore, + "bufferStore", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, + {OC::BufferUpdateCounter, + "BufferUpdateCounter", + OCC::BufferUpdateCounter, + "bufferUpdateCounter", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::CheckAccessFullyMapped, + "CheckAccessFullyMapped", + OCC::CheckAccessFullyMapped, + "checkAccessFullyMapped", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::GetDimensions, + "GetDimensions", + OCC::GetDimensions, + "getDimensions", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {}}, // Resources - gather void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::TextureGather, - "TextureGather", - OCC::TextureGather, - "textureGather", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::TextureGatherCmp, - "TextureGatherCmp", - OCC::TextureGatherCmp, - "textureGatherCmp", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::ReadOnly, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::TextureGather, + "TextureGather", + OCC::TextureGather, + "textureGather", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::TextureGatherCmp, + "TextureGatherCmp", + OCC::TextureGatherCmp, + "textureGatherCmp", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, // Resources - sample void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::Texture2DMSGetSamplePosition, - "Texture2DMSGetSamplePosition", - OCC::Texture2DMSGetSamplePosition, - "texture2DMSGetSamplePosition", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RenderTargetGetSamplePosition, - "RenderTargetGetSamplePosition", - OCC::RenderTargetGetSamplePosition, - "renderTargetGetSamplePosition", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RenderTargetGetSampleCount, - "RenderTargetGetSampleCount", - OCC::RenderTargetGetSampleCount, - "renderTargetGetSampleCount", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::Texture2DMSGetSamplePosition, + "Texture2DMSGetSamplePosition", + OCC::Texture2DMSGetSamplePosition, + "texture2DMSGetSamplePosition", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {}}, + {OC::RenderTargetGetSamplePosition, + "RenderTargetGetSamplePosition", + OCC::RenderTargetGetSamplePosition, + "renderTargetGetSamplePosition", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {}}, + {OC::RenderTargetGetSampleCount, + "RenderTargetGetSampleCount", + OCC::RenderTargetGetSampleCount, + "renderTargetGetSampleCount", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {}}, // Synchronization void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::AtomicBinOp, - "AtomicBinOp", - OCC::AtomicBinOp, - "atomicBinOp", - {false, false, false, false, false, false, false, true, true, false, - false, false}, - Attribute::None, - }, - { - OC::AtomicCompareExchange, - "AtomicCompareExchange", - OCC::AtomicCompareExchange, - "atomicCompareExchange", - {false, false, false, false, false, false, false, true, true, false, - false, false}, - Attribute::None, - }, - { - OC::Barrier, - "Barrier", - OCC::Barrier, - "barrier", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::NoDuplicate, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::AtomicBinOp, + "AtomicBinOp", + OCC::AtomicBinOp, + "atomicBinOp", + {false, false, false, false, false, false, false, true, true, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, + {OC::AtomicCompareExchange, + "AtomicCompareExchange", + OCC::AtomicCompareExchange, + "atomicCompareExchange", + {false, false, false, false, false, false, false, true, true, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, + {OC::Barrier, + "Barrier", + OCC::Barrier, + "barrier", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::NoDuplicate, + {}, + {}}, // Derivatives void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::CalculateLOD, - "CalculateLOD", - OCC::CalculateLOD, - "calculateLOD", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::CalculateLOD, + "CalculateLOD", + OCC::CalculateLOD, + "calculateLOD", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, // Pixel shader void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::Discard, - "Discard", - OCC::Discard, - "discard", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::Discard, + "Discard", + OCC::Discard, + "discard", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, // Derivatives void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::DerivCoarseX, - "DerivCoarseX", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::DerivCoarseY, - "DerivCoarseY", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::DerivFineX, - "DerivFineX", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::DerivFineY, - "DerivFineY", - OCC::Unary, - "unary", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::DerivCoarseX, + "DerivCoarseX", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::DerivCoarseY, + "DerivCoarseY", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::DerivFineX, + "DerivFineX", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::DerivFineY, + "DerivFineY", + OCC::Unary, + "unary", + {false, true, true, false, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Pixel shader void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::EvalSnapped, - "EvalSnapped", - OCC::EvalSnapped, - "evalSnapped", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::EvalSampleIndex, - "EvalSampleIndex", - OCC::EvalSampleIndex, - "evalSampleIndex", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::EvalCentroid, - "EvalCentroid", - OCC::EvalCentroid, - "evalCentroid", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::SampleIndex, - "SampleIndex", - OCC::SampleIndex, - "sampleIndex", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Coverage, - "Coverage", - OCC::Coverage, - "coverage", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::InnerCoverage, - "InnerCoverage", - OCC::InnerCoverage, - "innerCoverage", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::EvalSnapped, + "EvalSnapped", + OCC::EvalSnapped, + "evalSnapped", + {false, true, true, false, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::EvalSampleIndex, + "EvalSampleIndex", + OCC::EvalSampleIndex, + "evalSampleIndex", + {false, true, true, false, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::EvalCentroid, + "EvalCentroid", + OCC::EvalCentroid, + "evalCentroid", + {false, true, true, false, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::SampleIndex, + "SampleIndex", + OCC::SampleIndex, + "sampleIndex", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::Coverage, + "Coverage", + OCC::Coverage, + "coverage", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::InnerCoverage, + "InnerCoverage", + OCC::InnerCoverage, + "innerCoverage", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Compute/Mesh/Amplification/Node shader void, h, f, d, i1, - // i8, i16, i32, i64, udt, obj, vec, function attribute - { - OC::ThreadId, - "ThreadId", - OCC::ThreadId, - "threadId", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::GroupId, - "GroupId", - OCC::GroupId, - "groupId", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::ThreadIdInGroup, - "ThreadIdInGroup", - OCC::ThreadIdInGroup, - "threadIdInGroup", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::FlattenedThreadIdInGroup, - "FlattenedThreadIdInGroup", - OCC::FlattenedThreadIdInGroup, - "flattenedThreadIdInGroup", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // i8, i16, i32, i64, udt, obj, vec, function attribute, ext + // oload, vec oload + {OC::ThreadId, + "ThreadId", + OCC::ThreadId, + "threadId", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::GroupId, + "GroupId", + OCC::GroupId, + "groupId", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::ThreadIdInGroup, + "ThreadIdInGroup", + OCC::ThreadIdInGroup, + "threadIdInGroup", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::FlattenedThreadIdInGroup, + "FlattenedThreadIdInGroup", + OCC::FlattenedThreadIdInGroup, + "flattenedThreadIdInGroup", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Geometry shader void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::EmitStream, - "EmitStream", - OCC::EmitStream, - "emitStream", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::CutStream, - "CutStream", - OCC::CutStream, - "cutStream", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::EmitThenCutStream, - "EmitThenCutStream", - OCC::EmitThenCutStream, - "emitThenCutStream", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::GSInstanceID, - "GSInstanceID", - OCC::GSInstanceID, - "gsInstanceID", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::EmitStream, + "EmitStream", + OCC::EmitStream, + "emitStream", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::CutStream, + "CutStream", + OCC::CutStream, + "cutStream", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::EmitThenCutStream, + "EmitThenCutStream", + OCC::EmitThenCutStream, + "emitThenCutStream", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::GSInstanceID, + "GSInstanceID", + OCC::GSInstanceID, + "gsInstanceID", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Double precision void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::MakeDouble, - "MakeDouble", - OCC::MakeDouble, - "makeDouble", - {false, false, false, true, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::SplitDouble, - "SplitDouble", - OCC::SplitDouble, - "splitDouble", - {false, false, false, true, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::MakeDouble, + "MakeDouble", + OCC::MakeDouble, + "makeDouble", + {false, false, false, true, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::SplitDouble, + "SplitDouble", + OCC::SplitDouble, + "splitDouble", + {false, false, false, true, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Domain and hull shader void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj, vec, function attribute - { - OC::LoadOutputControlPoint, - "LoadOutputControlPoint", - OCC::LoadOutputControlPoint, - "loadOutputControlPoint", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::LoadPatchConstant, - "LoadPatchConstant", - OCC::LoadPatchConstant, - "loadPatchConstant", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // i32, i64, udt, obj, vec, function attribute, ext oload, vec + // oload + {OC::LoadOutputControlPoint, + "LoadOutputControlPoint", + OCC::LoadOutputControlPoint, + "loadOutputControlPoint", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::LoadPatchConstant, + "LoadPatchConstant", + OCC::LoadPatchConstant, + "loadPatchConstant", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Domain shader void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::DomainLocation, - "DomainLocation", - OCC::DomainLocation, - "domainLocation", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::DomainLocation, + "DomainLocation", + OCC::DomainLocation, + "domainLocation", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Hull shader void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::StorePatchConstant, - "StorePatchConstant", - OCC::StorePatchConstant, - "storePatchConstant", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::None, - }, - { - OC::OutputControlPointID, - "OutputControlPointID", - OCC::OutputControlPointID, - "outputControlPointID", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::StorePatchConstant, + "StorePatchConstant", + OCC::StorePatchConstant, + "storePatchConstant", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, + {OC::OutputControlPointID, + "OutputControlPointID", + OCC::OutputControlPointID, + "outputControlPointID", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Hull, Domain and Geometry shaders void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj, vec, function attribute - { - OC::PrimitiveID, - "PrimitiveID", - OCC::PrimitiveID, - "primitiveID", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // i16, i32, i64, udt, obj, vec, function attribute, ext oload, + // vec oload + {OC::PrimitiveID, + "PrimitiveID", + OCC::PrimitiveID, + "primitiveID", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Other void, h, f, d, i1, i8, i16, i32, i64, udt, - // obj, vec, function attribute - { - OC::CycleCounterLegacy, - "CycleCounterLegacy", - OCC::CycleCounterLegacy, - "cycleCounterLegacy", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, + // obj, vec, function attribute, ext oload, vec oload + {OC::CycleCounterLegacy, + "CycleCounterLegacy", + OCC::CycleCounterLegacy, + "cycleCounterLegacy", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, // Wave void, h, f, d, i1, i8, i16, i32, i64, udt, - // obj, vec, function attribute - { - OC::WaveIsFirstLane, - "WaveIsFirstLane", - OCC::WaveIsFirstLane, - "waveIsFirstLane", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::WaveGetLaneIndex, - "WaveGetLaneIndex", - OCC::WaveGetLaneIndex, - "waveGetLaneIndex", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::WaveGetLaneCount, - "WaveGetLaneCount", - OCC::WaveGetLaneCount, - "waveGetLaneCount", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::WaveAnyTrue, - "WaveAnyTrue", - OCC::WaveAnyTrue, - "waveAnyTrue", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::WaveAllTrue, - "WaveAllTrue", - OCC::WaveAllTrue, - "waveAllTrue", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::WaveActiveAllEqual, - "WaveActiveAllEqual", - OCC::WaveActiveAllEqual, - "waveActiveAllEqual", - {false, true, true, true, true, true, true, true, true, false, false, - false}, - Attribute::None, - }, - { - OC::WaveActiveBallot, - "WaveActiveBallot", - OCC::WaveActiveBallot, - "waveActiveBallot", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::WaveReadLaneAt, - "WaveReadLaneAt", - OCC::WaveReadLaneAt, - "waveReadLaneAt", - {false, true, true, true, true, true, true, true, true, false, false, - false}, - Attribute::None, - }, - { - OC::WaveReadLaneFirst, - "WaveReadLaneFirst", - OCC::WaveReadLaneFirst, - "waveReadLaneFirst", - {false, true, true, true, true, true, true, true, true, false, false, - false}, - Attribute::None, - }, - { - OC::WaveActiveOp, - "WaveActiveOp", - OCC::WaveActiveOp, - "waveActiveOp", - {false, true, true, true, true, true, true, true, true, false, false, - false}, - Attribute::None, - }, - { - OC::WaveActiveBit, - "WaveActiveBit", - OCC::WaveActiveBit, - "waveActiveBit", - {false, false, false, false, false, true, true, true, true, false, - false, false}, - Attribute::None, - }, - { - OC::WavePrefixOp, - "WavePrefixOp", - OCC::WavePrefixOp, - "wavePrefixOp", - {false, true, true, true, false, true, true, true, true, false, false, - false}, - Attribute::None, - }, + // obj, vec, function attribute, ext oload, vec oload + {OC::WaveIsFirstLane, + "WaveIsFirstLane", + OCC::WaveIsFirstLane, + "waveIsFirstLane", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::WaveGetLaneIndex, + "WaveGetLaneIndex", + OCC::WaveGetLaneIndex, + "waveGetLaneIndex", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {}}, + {OC::WaveGetLaneCount, + "WaveGetLaneCount", + OCC::WaveGetLaneCount, + "waveGetLaneCount", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {}}, + {OC::WaveAnyTrue, + "WaveAnyTrue", + OCC::WaveAnyTrue, + "waveAnyTrue", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::WaveAllTrue, + "WaveAllTrue", + OCC::WaveAllTrue, + "waveAllTrue", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::WaveActiveAllEqual, + "WaveActiveAllEqual", + OCC::WaveActiveAllEqual, + "waveActiveAllEqual", + {false, true, true, true, true, true, true, true, true, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, + {OC::WaveActiveBallot, + "WaveActiveBallot", + OCC::WaveActiveBallot, + "waveActiveBallot", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::WaveReadLaneAt, + "WaveReadLaneAt", + OCC::WaveReadLaneAt, + "waveReadLaneAt", + {false, true, true, true, true, true, true, true, true, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, + {OC::WaveReadLaneFirst, + "WaveReadLaneFirst", + OCC::WaveReadLaneFirst, + "waveReadLaneFirst", + {false, true, true, true, true, true, true, true, true, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, + {OC::WaveActiveOp, + "WaveActiveOp", + OCC::WaveActiveOp, + "waveActiveOp", + {false, true, true, true, true, true, true, true, true, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, + {OC::WaveActiveBit, + "WaveActiveBit", + OCC::WaveActiveBit, + "waveActiveBit", + {false, false, false, false, false, true, true, true, true, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, + {OC::WavePrefixOp, + "WavePrefixOp", + OCC::WavePrefixOp, + "wavePrefixOp", + {false, true, true, true, false, true, true, true, true, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, // Quad Wave Ops void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::QuadReadLaneAt, - "QuadReadLaneAt", - OCC::QuadReadLaneAt, - "quadReadLaneAt", - {false, true, true, true, true, true, true, true, true, false, false, - false}, - Attribute::None, - }, - { - OC::QuadOp, - "QuadOp", - OCC::QuadOp, - "quadOp", - {false, true, true, true, false, true, true, true, true, false, false, - false}, - Attribute::None, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::QuadReadLaneAt, + "QuadReadLaneAt", + OCC::QuadReadLaneAt, + "quadReadLaneAt", + {false, true, true, true, true, true, true, true, true, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, + {OC::QuadOp, + "QuadOp", + OCC::QuadOp, + "quadOp", + {false, true, true, true, false, true, true, true, true, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, // Bitcasts with different sizes void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj, vec, function attribute - { - OC::BitcastI16toF16, - "BitcastI16toF16", - OCC::BitcastI16toF16, - "bitcastI16toF16", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::BitcastF16toI16, - "BitcastF16toI16", - OCC::BitcastF16toI16, - "bitcastF16toI16", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::BitcastI32toF32, - "BitcastI32toF32", - OCC::BitcastI32toF32, - "bitcastI32toF32", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::BitcastF32toI32, - "BitcastF32toI32", - OCC::BitcastF32toI32, - "bitcastF32toI32", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::BitcastI64toF64, - "BitcastI64toF64", - OCC::BitcastI64toF64, - "bitcastI64toF64", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::BitcastF64toI64, - "BitcastF64toI64", - OCC::BitcastF64toI64, - "bitcastF64toI64", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, + // i16, i32, i64, udt, obj, vec, function attribute, ext oload, + // vec oload + {OC::BitcastI16toF16, + "BitcastI16toF16", + OCC::BitcastI16toF16, + "bitcastI16toF16", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {}}, + {OC::BitcastF16toI16, + "BitcastF16toI16", + OCC::BitcastF16toI16, + "bitcastF16toI16", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {}}, + {OC::BitcastI32toF32, + "BitcastI32toF32", + OCC::BitcastI32toF32, + "bitcastI32toF32", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {}}, + {OC::BitcastF32toI32, + "BitcastF32toI32", + OCC::BitcastF32toI32, + "bitcastF32toI32", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {}}, + {OC::BitcastI64toF64, + "BitcastI64toF64", + OCC::BitcastI64toF64, + "bitcastI64toF64", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {}}, + {OC::BitcastF64toI64, + "BitcastF64toI64", + OCC::BitcastF64toI64, + "bitcastF64toI64", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {}}, // Legacy floating-point void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj, vec, function attribute - { - OC::LegacyF32ToF16, - "LegacyF32ToF16", - OCC::LegacyF32ToF16, - "legacyF32ToF16", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::LegacyF16ToF32, - "LegacyF16ToF32", - OCC::LegacyF16ToF32, - "legacyF16ToF32", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, + // i32, i64, udt, obj, vec, function attribute, ext oload, vec + // oload + {OC::LegacyF32ToF16, + "LegacyF32ToF16", + OCC::LegacyF32ToF16, + "legacyF32ToF16", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {}}, + {OC::LegacyF16ToF32, + "LegacyF16ToF32", + OCC::LegacyF16ToF32, + "legacyF16ToF32", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {}}, // Double precision void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::LegacyDoubleToFloat, - "LegacyDoubleToFloat", - OCC::LegacyDoubleToFloat, - "legacyDoubleToFloat", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::LegacyDoubleToSInt32, - "LegacyDoubleToSInt32", - OCC::LegacyDoubleToSInt32, - "legacyDoubleToSInt32", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::LegacyDoubleToUInt32, - "LegacyDoubleToUInt32", - OCC::LegacyDoubleToUInt32, - "legacyDoubleToUInt32", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::LegacyDoubleToFloat, + "LegacyDoubleToFloat", + OCC::LegacyDoubleToFloat, + "legacyDoubleToFloat", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {}}, + {OC::LegacyDoubleToSInt32, + "LegacyDoubleToSInt32", + OCC::LegacyDoubleToSInt32, + "legacyDoubleToSInt32", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {}}, + {OC::LegacyDoubleToUInt32, + "LegacyDoubleToUInt32", + OCC::LegacyDoubleToUInt32, + "legacyDoubleToUInt32", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {}}, // Wave void, h, f, d, i1, i8, i16, i32, i64, udt, - // obj, vec, function attribute - { - OC::WaveAllBitCount, - "WaveAllBitCount", - OCC::WaveAllOp, - "waveAllOp", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::WavePrefixBitCount, - "WavePrefixBitCount", - OCC::WavePrefixOp, - "wavePrefixOp", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, + // obj, vec, function attribute, ext oload, vec oload + {OC::WaveAllBitCount, + "WaveAllBitCount", + OCC::WaveAllOp, + "waveAllOp", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::WavePrefixBitCount, + "WavePrefixBitCount", + OCC::WavePrefixOp, + "wavePrefixOp", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, // Pixel shader void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::AttributeAtVertex, - "AttributeAtVertex", - OCC::AttributeAtVertex, - "attributeAtVertex", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::AttributeAtVertex, + "AttributeAtVertex", + OCC::AttributeAtVertex, + "attributeAtVertex", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Graphics shader void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::ViewID, - "ViewID", - OCC::ViewID, - "viewID", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::ViewID, + "ViewID", + OCC::ViewID, + "viewID", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Resources void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::RawBufferLoad, - "RawBufferLoad", - OCC::RawBufferLoad, - "rawBufferLoad", - {false, true, true, true, false, false, true, true, true, false, false, - false}, - Attribute::ReadOnly, - }, - { - OC::RawBufferStore, - "RawBufferStore", - OCC::RawBufferStore, - "rawBufferStore", - {false, true, true, true, false, false, true, true, true, false, false, - false}, - Attribute::None, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::RawBufferLoad, + "RawBufferLoad", + OCC::RawBufferLoad, + "rawBufferLoad", + {false, true, true, true, false, false, true, true, true, false, false, + false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RawBufferStore, + "RawBufferStore", + OCC::RawBufferStore, + "rawBufferStore", + {false, true, true, true, false, false, true, true, true, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, // Raytracing object space uint System Values void, h, f, d, i1, - // i8, i16, i32, i64, udt, obj, vec, function attribute - { - OC::InstanceID, - "InstanceID", - OCC::InstanceID, - "instanceID", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::InstanceIndex, - "InstanceIndex", - OCC::InstanceIndex, - "instanceIndex", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // i8, i16, i32, i64, udt, obj, vec, function attribute, ext + // oload, vec oload + {OC::InstanceID, + "InstanceID", + OCC::InstanceID, + "instanceID", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::InstanceIndex, + "InstanceIndex", + OCC::InstanceIndex, + "instanceIndex", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Raytracing hit uint System Values void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj, vec, function attribute - { - OC::HitKind, - "HitKind", - OCC::HitKind, - "hitKind", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // i16, i32, i64, udt, obj, vec, function attribute, ext oload, + // vec oload + {OC::HitKind, + "HitKind", + OCC::HitKind, + "hitKind", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Raytracing uint System Values void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj, vec, function attribute - { - OC::RayFlags, - "RayFlags", - OCC::RayFlags, - "rayFlags", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // i16, i32, i64, udt, obj, vec, function attribute, ext oload, + // vec oload + {OC::RayFlags, + "RayFlags", + OCC::RayFlags, + "rayFlags", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Ray Dispatch Arguments void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj, vec, function attribute - { - OC::DispatchRaysIndex, - "DispatchRaysIndex", - OCC::DispatchRaysIndex, - "dispatchRaysIndex", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::DispatchRaysDimensions, - "DispatchRaysDimensions", - OCC::DispatchRaysDimensions, - "dispatchRaysDimensions", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // i32, i64, udt, obj, vec, function attribute, ext oload, vec + // oload + {OC::DispatchRaysIndex, + "DispatchRaysIndex", + OCC::DispatchRaysIndex, + "dispatchRaysIndex", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::DispatchRaysDimensions, + "DispatchRaysDimensions", + OCC::DispatchRaysDimensions, + "dispatchRaysDimensions", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Ray Vectors void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::WorldRayOrigin, - "WorldRayOrigin", - OCC::WorldRayOrigin, - "worldRayOrigin", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::WorldRayDirection, - "WorldRayDirection", - OCC::WorldRayDirection, - "worldRayDirection", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::WorldRayOrigin, + "WorldRayOrigin", + OCC::WorldRayOrigin, + "worldRayOrigin", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::WorldRayDirection, + "WorldRayDirection", + OCC::WorldRayDirection, + "worldRayDirection", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Ray object space Vectors void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj, vec, function attribute - { - OC::ObjectRayOrigin, - "ObjectRayOrigin", - OCC::ObjectRayOrigin, - "objectRayOrigin", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::ObjectRayDirection, - "ObjectRayDirection", - OCC::ObjectRayDirection, - "objectRayDirection", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, + // i32, i64, udt, obj, vec, function attribute, ext oload, vec + // oload + {OC::ObjectRayOrigin, + "ObjectRayOrigin", + OCC::ObjectRayOrigin, + "objectRayOrigin", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::ObjectRayDirection, + "ObjectRayDirection", + OCC::ObjectRayDirection, + "objectRayDirection", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Ray Transforms void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::ObjectToWorld, - "ObjectToWorld", - OCC::ObjectToWorld, - "objectToWorld", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::WorldToObject, - "WorldToObject", - OCC::WorldToObject, - "worldToObject", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::ObjectToWorld, + "ObjectToWorld", + OCC::ObjectToWorld, + "objectToWorld", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::WorldToObject, + "WorldToObject", + OCC::WorldToObject, + "worldToObject", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // RayT void, h, f, d, i1, i8, i16, i32, i64, udt, - // obj, vec, function attribute - { - OC::RayTMin, - "RayTMin", - OCC::RayTMin, - "rayTMin", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::RayTCurrent, - "RayTCurrent", - OCC::RayTCurrent, - "rayTCurrent", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, + // obj, vec, function attribute, ext oload, vec oload + {OC::RayTMin, + "RayTMin", + OCC::RayTMin, + "rayTMin", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::RayTCurrent, + "RayTCurrent", + OCC::RayTCurrent, + "rayTCurrent", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, // AnyHit Terminals void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::IgnoreHit, - "IgnoreHit", - OCC::IgnoreHit, - "ignoreHit", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::NoReturn, - }, - { - OC::AcceptHitAndEndSearch, - "AcceptHitAndEndSearch", - OCC::AcceptHitAndEndSearch, - "acceptHitAndEndSearch", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::NoReturn, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::IgnoreHit, + "IgnoreHit", + OCC::IgnoreHit, + "ignoreHit", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::NoReturn, + {}, + {}}, + {OC::AcceptHitAndEndSearch, + "AcceptHitAndEndSearch", + OCC::AcceptHitAndEndSearch, + "acceptHitAndEndSearch", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::NoReturn, + {}, + {}}, // Indirect Shader Invocation void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj, vec, function attribute - { - OC::TraceRay, - "TraceRay", - OCC::TraceRay, - "traceRay", - {false, false, false, false, false, false, false, false, false, true, - false, false}, - Attribute::None, - }, - { - OC::ReportHit, - "ReportHit", - OCC::ReportHit, - "reportHit", - {false, false, false, false, false, false, false, false, false, true, - false, false}, - Attribute::None, - }, - { - OC::CallShader, - "CallShader", - OCC::CallShader, - "callShader", - {false, false, false, false, false, false, false, false, false, true, - false, false}, - Attribute::None, - }, + // i32, i64, udt, obj, vec, function attribute, ext oload, vec + // oload + {OC::TraceRay, + "TraceRay", + OCC::TraceRay, + "traceRay", + {false, false, false, false, false, false, false, false, false, true, + false, false, false}, + Attribute::None, + {}, + {0x00}}, + {OC::ReportHit, + "ReportHit", + OCC::ReportHit, + "reportHit", + {false, false, false, false, false, false, false, false, false, true, + false, false, false}, + Attribute::None, + {}, + {0x00}}, + {OC::CallShader, + "CallShader", + OCC::CallShader, + "callShader", + {false, false, false, false, false, false, false, false, false, true, + false, false, false}, + Attribute::None, + {}, + {0x00}}, // Library create handle from resource struct (like HL intrinsic) void, h, // f, d, i1, i8, i16, i32, i64, udt, obj, vec, - // function attribute - { - OC::CreateHandleForLib, - "CreateHandleForLib", - OCC::CreateHandleForLib, - "createHandleForLib", - {false, false, false, false, false, false, false, false, false, false, - true, false}, - Attribute::ReadOnly, - }, + // function attribute, ext oload, vec oload + {OC::CreateHandleForLib, + "CreateHandleForLib", + OCC::CreateHandleForLib, + "createHandleForLib", + {false, false, false, false, false, false, false, false, false, false, + true, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, // Raytracing object space uint System Values void, h, f, d, i1, - // i8, i16, i32, i64, udt, obj, vec, function attribute - { - OC::PrimitiveIndex, - "PrimitiveIndex", - OCC::PrimitiveIndex, - "primitiveIndex", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // i8, i16, i32, i64, udt, obj, vec, function attribute, ext + // oload, vec oload + {OC::PrimitiveIndex, + "PrimitiveIndex", + OCC::PrimitiveIndex, + "primitiveIndex", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Dot product with accumulate void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj, vec, function attribute - { - OC::Dot2AddHalf, - "Dot2AddHalf", - OCC::Dot2AddHalf, - "dot2AddHalf", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Dot4AddI8Packed, - "Dot4AddI8Packed", - OCC::Dot4AddPacked, - "dot4AddPacked", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::Dot4AddU8Packed, - "Dot4AddU8Packed", - OCC::Dot4AddPacked, - "dot4AddPacked", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // i32, i64, udt, obj, vec, function attribute, ext oload, vec + // oload + {OC::Dot2AddHalf, + "Dot2AddHalf", + OCC::Dot2AddHalf, + "dot2AddHalf", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::Dot4AddI8Packed, + "Dot4AddI8Packed", + OCC::Dot4AddPacked, + "dot4AddPacked", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::Dot4AddU8Packed, + "Dot4AddU8Packed", + OCC::Dot4AddPacked, + "dot4AddPacked", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Wave void, h, f, d, i1, i8, i16, i32, i64, udt, - // obj, vec, function attribute - { - OC::WaveMatch, - "WaveMatch", - OCC::WaveMatch, - "waveMatch", - {false, true, true, true, false, true, true, true, true, false, false, - false}, - Attribute::None, - }, - { - OC::WaveMultiPrefixOp, - "WaveMultiPrefixOp", - OCC::WaveMultiPrefixOp, - "waveMultiPrefixOp", - {false, true, true, true, false, true, true, true, true, false, false, - false}, - Attribute::None, - }, - { - OC::WaveMultiPrefixBitCount, - "WaveMultiPrefixBitCount", - OCC::WaveMultiPrefixBitCount, - "waveMultiPrefixBitCount", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, + // obj, vec, function attribute, ext oload, vec oload + {OC::WaveMatch, + "WaveMatch", + OCC::WaveMatch, + "waveMatch", + {false, true, true, true, false, true, true, true, true, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, + {OC::WaveMultiPrefixOp, + "WaveMultiPrefixOp", + OCC::WaveMultiPrefixOp, + "waveMultiPrefixOp", + {false, true, true, true, false, true, true, true, true, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, + {OC::WaveMultiPrefixBitCount, + "WaveMultiPrefixBitCount", + OCC::WaveMultiPrefixBitCount, + "waveMultiPrefixBitCount", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, // Mesh shader instructions void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj, vec, function attribute - { - OC::SetMeshOutputCounts, - "SetMeshOutputCounts", - OCC::SetMeshOutputCounts, - "setMeshOutputCounts", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::EmitIndices, - "EmitIndices", - OCC::EmitIndices, - "emitIndices", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::GetMeshPayload, - "GetMeshPayload", - OCC::GetMeshPayload, - "getMeshPayload", - {false, false, false, false, false, false, false, false, false, true, - false, false}, - Attribute::ReadOnly, - }, - { - OC::StoreVertexOutput, - "StoreVertexOutput", - OCC::StoreVertexOutput, - "storeVertexOutput", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::None, - }, - { - OC::StorePrimitiveOutput, - "StorePrimitiveOutput", - OCC::StorePrimitiveOutput, - "storePrimitiveOutput", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::None, - }, + // i32, i64, udt, obj, vec, function attribute, ext oload, vec + // oload + {OC::SetMeshOutputCounts, + "SetMeshOutputCounts", + OCC::SetMeshOutputCounts, + "setMeshOutputCounts", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::EmitIndices, + "EmitIndices", + OCC::EmitIndices, + "emitIndices", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::GetMeshPayload, + "GetMeshPayload", + OCC::GetMeshPayload, + "getMeshPayload", + {false, false, false, false, false, false, false, false, false, true, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::StoreVertexOutput, + "StoreVertexOutput", + OCC::StoreVertexOutput, + "storeVertexOutput", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, + {OC::StorePrimitiveOutput, + "StorePrimitiveOutput", + OCC::StorePrimitiveOutput, + "storePrimitiveOutput", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, // Amplification shader instructions void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj, vec, function attribute - { - OC::DispatchMesh, - "DispatchMesh", - OCC::DispatchMesh, - "dispatchMesh", - {false, false, false, false, false, false, false, false, false, true, - false, false}, - Attribute::None, - }, + // i16, i32, i64, udt, obj, vec, function attribute, ext oload, + // vec oload + {OC::DispatchMesh, + "DispatchMesh", + OCC::DispatchMesh, + "dispatchMesh", + {false, false, false, false, false, false, false, false, false, true, + false, false, false}, + Attribute::None, + {}, + {0x00}}, // Sampler Feedback void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::WriteSamplerFeedback, - "WriteSamplerFeedback", - OCC::WriteSamplerFeedback, - "writeSamplerFeedback", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::WriteSamplerFeedbackBias, - "WriteSamplerFeedbackBias", - OCC::WriteSamplerFeedbackBias, - "writeSamplerFeedbackBias", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::WriteSamplerFeedbackLevel, - "WriteSamplerFeedbackLevel", - OCC::WriteSamplerFeedbackLevel, - "writeSamplerFeedbackLevel", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::WriteSamplerFeedbackGrad, - "WriteSamplerFeedbackGrad", - OCC::WriteSamplerFeedbackGrad, - "writeSamplerFeedbackGrad", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::WriteSamplerFeedback, + "WriteSamplerFeedback", + OCC::WriteSamplerFeedback, + "writeSamplerFeedback", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::WriteSamplerFeedbackBias, + "WriteSamplerFeedbackBias", + OCC::WriteSamplerFeedbackBias, + "writeSamplerFeedbackBias", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::WriteSamplerFeedbackLevel, + "WriteSamplerFeedbackLevel", + OCC::WriteSamplerFeedbackLevel, + "writeSamplerFeedbackLevel", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::WriteSamplerFeedbackGrad, + "WriteSamplerFeedbackGrad", + OCC::WriteSamplerFeedbackGrad, + "writeSamplerFeedbackGrad", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, // Inline Ray Query void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::AllocateRayQuery, - "AllocateRayQuery", - OCC::AllocateRayQuery, - "allocateRayQuery", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::RayQuery_TraceRayInline, - "RayQuery_TraceRayInline", - OCC::RayQuery_TraceRayInline, - "rayQuery_TraceRayInline", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::RayQuery_Proceed, - "RayQuery_Proceed", - OCC::RayQuery_Proceed, - "rayQuery_Proceed", - {false, false, false, false, true, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::RayQuery_Abort, - "RayQuery_Abort", - OCC::RayQuery_Abort, - "rayQuery_Abort", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::RayQuery_CommitNonOpaqueTriangleHit, - "RayQuery_CommitNonOpaqueTriangleHit", - OCC::RayQuery_CommitNonOpaqueTriangleHit, - "rayQuery_CommitNonOpaqueTriangleHit", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::RayQuery_CommitProceduralPrimitiveHit, - "RayQuery_CommitProceduralPrimitiveHit", - OCC::RayQuery_CommitProceduralPrimitiveHit, - "rayQuery_CommitProceduralPrimitiveHit", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::RayQuery_CommittedStatus, - "RayQuery_CommittedStatus", - OCC::RayQuery_StateScalar, - "rayQuery_StateScalar", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CandidateType, - "RayQuery_CandidateType", - OCC::RayQuery_StateScalar, - "rayQuery_StateScalar", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CandidateObjectToWorld3x4, - "RayQuery_CandidateObjectToWorld3x4", - OCC::RayQuery_StateMatrix, - "rayQuery_StateMatrix", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CandidateWorldToObject3x4, - "RayQuery_CandidateWorldToObject3x4", - OCC::RayQuery_StateMatrix, - "rayQuery_StateMatrix", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CommittedObjectToWorld3x4, - "RayQuery_CommittedObjectToWorld3x4", - OCC::RayQuery_StateMatrix, - "rayQuery_StateMatrix", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CommittedWorldToObject3x4, - "RayQuery_CommittedWorldToObject3x4", - OCC::RayQuery_StateMatrix, - "rayQuery_StateMatrix", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CandidateProceduralPrimitiveNonOpaque, - "RayQuery_CandidateProceduralPrimitiveNonOpaque", - OCC::RayQuery_StateScalar, - "rayQuery_StateScalar", - {false, false, false, false, true, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CandidateTriangleFrontFace, - "RayQuery_CandidateTriangleFrontFace", - OCC::RayQuery_StateScalar, - "rayQuery_StateScalar", - {false, false, false, false, true, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CommittedTriangleFrontFace, - "RayQuery_CommittedTriangleFrontFace", - OCC::RayQuery_StateScalar, - "rayQuery_StateScalar", - {false, false, false, false, true, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CandidateTriangleBarycentrics, - "RayQuery_CandidateTriangleBarycentrics", - OCC::RayQuery_StateVector, - "rayQuery_StateVector", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CommittedTriangleBarycentrics, - "RayQuery_CommittedTriangleBarycentrics", - OCC::RayQuery_StateVector, - "rayQuery_StateVector", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_RayFlags, - "RayQuery_RayFlags", - OCC::RayQuery_StateScalar, - "rayQuery_StateScalar", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_WorldRayOrigin, - "RayQuery_WorldRayOrigin", - OCC::RayQuery_StateVector, - "rayQuery_StateVector", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_WorldRayDirection, - "RayQuery_WorldRayDirection", - OCC::RayQuery_StateVector, - "rayQuery_StateVector", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_RayTMin, - "RayQuery_RayTMin", - OCC::RayQuery_StateScalar, - "rayQuery_StateScalar", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CandidateTriangleRayT, - "RayQuery_CandidateTriangleRayT", - OCC::RayQuery_StateScalar, - "rayQuery_StateScalar", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CommittedRayT, - "RayQuery_CommittedRayT", - OCC::RayQuery_StateScalar, - "rayQuery_StateScalar", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CandidateInstanceIndex, - "RayQuery_CandidateInstanceIndex", - OCC::RayQuery_StateScalar, - "rayQuery_StateScalar", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CandidateInstanceID, - "RayQuery_CandidateInstanceID", - OCC::RayQuery_StateScalar, - "rayQuery_StateScalar", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CandidateGeometryIndex, - "RayQuery_CandidateGeometryIndex", - OCC::RayQuery_StateScalar, - "rayQuery_StateScalar", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CandidatePrimitiveIndex, - "RayQuery_CandidatePrimitiveIndex", - OCC::RayQuery_StateScalar, - "rayQuery_StateScalar", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CandidateObjectRayOrigin, - "RayQuery_CandidateObjectRayOrigin", - OCC::RayQuery_StateVector, - "rayQuery_StateVector", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CandidateObjectRayDirection, - "RayQuery_CandidateObjectRayDirection", - OCC::RayQuery_StateVector, - "rayQuery_StateVector", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CommittedInstanceIndex, - "RayQuery_CommittedInstanceIndex", - OCC::RayQuery_StateScalar, - "rayQuery_StateScalar", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CommittedInstanceID, - "RayQuery_CommittedInstanceID", - OCC::RayQuery_StateScalar, - "rayQuery_StateScalar", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CommittedGeometryIndex, - "RayQuery_CommittedGeometryIndex", - OCC::RayQuery_StateScalar, - "rayQuery_StateScalar", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CommittedPrimitiveIndex, - "RayQuery_CommittedPrimitiveIndex", - OCC::RayQuery_StateScalar, - "rayQuery_StateScalar", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CommittedObjectRayOrigin, - "RayQuery_CommittedObjectRayOrigin", - OCC::RayQuery_StateVector, - "rayQuery_StateVector", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CommittedObjectRayDirection, - "RayQuery_CommittedObjectRayDirection", - OCC::RayQuery_StateVector, - "rayQuery_StateVector", - {false, false, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::AllocateRayQuery, + "AllocateRayQuery", + OCC::AllocateRayQuery, + "allocateRayQuery", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::RayQuery_TraceRayInline, + "RayQuery_TraceRayInline", + OCC::RayQuery_TraceRayInline, + "rayQuery_TraceRayInline", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::RayQuery_Proceed, + "RayQuery_Proceed", + OCC::RayQuery_Proceed, + "rayQuery_Proceed", + {false, false, false, false, true, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {0x00}}, + {OC::RayQuery_Abort, + "RayQuery_Abort", + OCC::RayQuery_Abort, + "rayQuery_Abort", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::RayQuery_CommitNonOpaqueTriangleHit, + "RayQuery_CommitNonOpaqueTriangleHit", + OCC::RayQuery_CommitNonOpaqueTriangleHit, + "rayQuery_CommitNonOpaqueTriangleHit", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::RayQuery_CommitProceduralPrimitiveHit, + "RayQuery_CommitProceduralPrimitiveHit", + OCC::RayQuery_CommitProceduralPrimitiveHit, + "rayQuery_CommitProceduralPrimitiveHit", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::RayQuery_CommittedStatus, + "RayQuery_CommittedStatus", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CandidateType, + "RayQuery_CandidateType", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CandidateObjectToWorld3x4, + "RayQuery_CandidateObjectToWorld3x4", + OCC::RayQuery_StateMatrix, + "rayQuery_StateMatrix", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CandidateWorldToObject3x4, + "RayQuery_CandidateWorldToObject3x4", + OCC::RayQuery_StateMatrix, + "rayQuery_StateMatrix", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CommittedObjectToWorld3x4, + "RayQuery_CommittedObjectToWorld3x4", + OCC::RayQuery_StateMatrix, + "rayQuery_StateMatrix", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CommittedWorldToObject3x4, + "RayQuery_CommittedWorldToObject3x4", + OCC::RayQuery_StateMatrix, + "rayQuery_StateMatrix", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CandidateProceduralPrimitiveNonOpaque, + "RayQuery_CandidateProceduralPrimitiveNonOpaque", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + {false, false, false, false, true, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CandidateTriangleFrontFace, + "RayQuery_CandidateTriangleFrontFace", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + {false, false, false, false, true, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CommittedTriangleFrontFace, + "RayQuery_CommittedTriangleFrontFace", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + {false, false, false, false, true, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CandidateTriangleBarycentrics, + "RayQuery_CandidateTriangleBarycentrics", + OCC::RayQuery_StateVector, + "rayQuery_StateVector", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CommittedTriangleBarycentrics, + "RayQuery_CommittedTriangleBarycentrics", + OCC::RayQuery_StateVector, + "rayQuery_StateVector", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_RayFlags, + "RayQuery_RayFlags", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_WorldRayOrigin, + "RayQuery_WorldRayOrigin", + OCC::RayQuery_StateVector, + "rayQuery_StateVector", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_WorldRayDirection, + "RayQuery_WorldRayDirection", + OCC::RayQuery_StateVector, + "rayQuery_StateVector", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_RayTMin, + "RayQuery_RayTMin", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CandidateTriangleRayT, + "RayQuery_CandidateTriangleRayT", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CommittedRayT, + "RayQuery_CommittedRayT", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CandidateInstanceIndex, + "RayQuery_CandidateInstanceIndex", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CandidateInstanceID, + "RayQuery_CandidateInstanceID", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CandidateGeometryIndex, + "RayQuery_CandidateGeometryIndex", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CandidatePrimitiveIndex, + "RayQuery_CandidatePrimitiveIndex", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CandidateObjectRayOrigin, + "RayQuery_CandidateObjectRayOrigin", + OCC::RayQuery_StateVector, + "rayQuery_StateVector", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CandidateObjectRayDirection, + "RayQuery_CandidateObjectRayDirection", + OCC::RayQuery_StateVector, + "rayQuery_StateVector", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CommittedInstanceIndex, + "RayQuery_CommittedInstanceIndex", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CommittedInstanceID, + "RayQuery_CommittedInstanceID", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CommittedGeometryIndex, + "RayQuery_CommittedGeometryIndex", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CommittedPrimitiveIndex, + "RayQuery_CommittedPrimitiveIndex", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CommittedObjectRayOrigin, + "RayQuery_CommittedObjectRayOrigin", + OCC::RayQuery_StateVector, + "rayQuery_StateVector", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CommittedObjectRayDirection, + "RayQuery_CommittedObjectRayDirection", + OCC::RayQuery_StateVector, + "rayQuery_StateVector", + {false, false, true, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, // Raytracing object space uint System Values, raytracing tier 1.1 void, h, // f, d, i1, i8, i16, i32, i64, udt, obj, vec, - // function attribute - { - OC::GeometryIndex, - "GeometryIndex", - OCC::GeometryIndex, - "geometryIndex", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // function attribute, ext oload, vec oload + {OC::GeometryIndex, + "GeometryIndex", + OCC::GeometryIndex, + "geometryIndex", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Inline Ray Query void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::RayQuery_CandidateInstanceContributionToHitGroupIndex, - "RayQuery_CandidateInstanceContributionToHitGroupIndex", - OCC::RayQuery_StateScalar, - "rayQuery_StateScalar", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::RayQuery_CommittedInstanceContributionToHitGroupIndex, - "RayQuery_CommittedInstanceContributionToHitGroupIndex", - OCC::RayQuery_StateScalar, - "rayQuery_StateScalar", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadOnly, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::RayQuery_CandidateInstanceContributionToHitGroupIndex, + "RayQuery_CandidateInstanceContributionToHitGroupIndex", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::RayQuery_CommittedInstanceContributionToHitGroupIndex, + "RayQuery_CommittedInstanceContributionToHitGroupIndex", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, // Get handle from heap void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::AnnotateHandle, - "AnnotateHandle", - OCC::AnnotateHandle, - "annotateHandle", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::CreateHandleFromBinding, - "CreateHandleFromBinding", - OCC::CreateHandleFromBinding, - "createHandleFromBinding", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::CreateHandleFromHeap, - "CreateHandleFromHeap", - OCC::CreateHandleFromHeap, - "createHandleFromHeap", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::AnnotateHandle, + "AnnotateHandle", + OCC::AnnotateHandle, + "annotateHandle", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {}}, + {OC::CreateHandleFromBinding, + "CreateHandleFromBinding", + OCC::CreateHandleFromBinding, + "createHandleFromBinding", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {}}, + {OC::CreateHandleFromHeap, + "CreateHandleFromHeap", + OCC::CreateHandleFromHeap, + "createHandleFromHeap", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {}}, // Unpacking intrinsics void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::Unpack4x8, - "Unpack4x8", - OCC::Unpack4x8, - "unpack4x8", - {false, false, false, false, false, false, true, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::Unpack4x8, + "Unpack4x8", + OCC::Unpack4x8, + "unpack4x8", + {false, false, false, false, false, false, true, true, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Packing intrinsics void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::Pack4x8, - "Pack4x8", - OCC::Pack4x8, - "pack4x8", - {false, false, false, false, false, false, true, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::Pack4x8, + "Pack4x8", + OCC::Pack4x8, + "pack4x8", + {false, false, false, false, false, false, true, true, false, false, false, + false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Helper Lanes void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::IsHelperLane, - "IsHelperLane", - OCC::IsHelperLane, - "isHelperLane", - {false, false, false, false, true, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::IsHelperLane, + "IsHelperLane", + OCC::IsHelperLane, + "isHelperLane", + {false, false, false, false, true, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, // Quad Wave Ops void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::QuadVote, - "QuadVote", - OCC::QuadVote, - "quadVote", - {false, false, false, false, true, false, false, false, false, false, - false, false}, - Attribute::None, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::QuadVote, + "QuadVote", + OCC::QuadVote, + "quadVote", + {false, false, false, false, true, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {0x00}}, // Resources - gather void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::TextureGatherRaw, - "TextureGatherRaw", - OCC::TextureGatherRaw, - "textureGatherRaw", - {false, false, false, false, false, false, true, true, true, false, - false, false}, - Attribute::ReadOnly, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::TextureGatherRaw, + "TextureGatherRaw", + OCC::TextureGatherRaw, + "textureGatherRaw", + {false, false, false, false, false, false, true, true, true, false, false, + false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, // Resources - sample void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::SampleCmpLevel, - "SampleCmpLevel", - OCC::SampleCmpLevel, - "sampleCmpLevel", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::SampleCmpLevel, + "SampleCmpLevel", + OCC::SampleCmpLevel, + "sampleCmpLevel", + {false, true, true, false, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, // Resources void, h, f, d, i1, i8, i16, i32, i64, - // udt, obj, vec, function attribute - { - OC::TextureStoreSample, - "TextureStoreSample", - OCC::TextureStoreSample, - "textureStoreSample", - {false, true, true, false, false, false, true, true, false, false, - false, false}, - Attribute::None, - }, - - // void, h, f, d, i1, i8, i16, i32, i64, udt, obj, vec, function attribute - { - OC::Reserved0, - "Reserved0", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::Reserved1, - "Reserved1", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::Reserved2, - "Reserved2", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::Reserved3, - "Reserved3", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::Reserved4, - "Reserved4", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::Reserved5, - "Reserved5", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::Reserved6, - "Reserved6", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::Reserved7, - "Reserved7", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::Reserved8, - "Reserved8", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::Reserved9, - "Reserved9", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::Reserved10, - "Reserved10", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::Reserved11, - "Reserved11", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, + // udt, obj, vec, function attribute, ext oload, vec oload + {OC::TextureStoreSample, + "TextureStoreSample", + OCC::TextureStoreSample, + "textureStoreSample", + {false, true, true, false, false, false, true, true, false, false, false, + false, false}, + Attribute::None, + {}, + {0x00}}, + + // void, h, f, d, i1, i8, i16, i32, i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::Reserved0, + "Reserved0", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::Reserved1, + "Reserved1", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::Reserved2, + "Reserved2", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::Reserved3, + "Reserved3", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::Reserved4, + "Reserved4", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::Reserved5, + "Reserved5", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::Reserved6, + "Reserved6", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::Reserved7, + "Reserved7", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::Reserved8, + "Reserved8", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::Reserved9, + "Reserved9", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::Reserved10, + "Reserved10", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::Reserved11, + "Reserved11", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, // Create/Annotate Node Handles void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj, vec, function attribute - { - OC::AllocateNodeOutputRecords, - "AllocateNodeOutputRecords", - OCC::AllocateNodeOutputRecords, - "allocateNodeOutputRecords", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, + // i16, i32, i64, udt, obj, vec, function attribute, ext oload, + // vec oload + {OC::AllocateNodeOutputRecords, + "AllocateNodeOutputRecords", + OCC::AllocateNodeOutputRecords, + "allocateNodeOutputRecords", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, // Get Pointer to Node Record in Address Space 6 void, h, f, d, - // i1, i8, i16, i32, i64, udt, obj, vec, function attribute - { - OC::GetNodeRecordPtr, - "GetNodeRecordPtr", - OCC::GetNodeRecordPtr, - "getNodeRecordPtr", - {false, false, false, false, false, false, false, false, false, true, - false, false}, - Attribute::ReadNone, - }, + // i1, i8, i16, i32, i64, udt, obj, vec, function attribute, + // ext oload, vec oload + {OC::GetNodeRecordPtr, + "GetNodeRecordPtr", + OCC::GetNodeRecordPtr, + "getNodeRecordPtr", + {false, false, false, false, false, false, false, false, false, true, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Work Graph intrinsics void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj, vec, function attribute - { - OC::IncrementOutputCount, - "IncrementOutputCount", - OCC::IncrementOutputCount, - "incrementOutputCount", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::OutputComplete, - "OutputComplete", - OCC::OutputComplete, - "outputComplete", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::GetInputRecordCount, - "GetInputRecordCount", - OCC::GetInputRecordCount, - "getInputRecordCount", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::FinishedCrossGroupSharing, - "FinishedCrossGroupSharing", - OCC::FinishedCrossGroupSharing, - "finishedCrossGroupSharing", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, + // i32, i64, udt, obj, vec, function attribute, ext oload, vec + // oload + {OC::IncrementOutputCount, + "IncrementOutputCount", + OCC::IncrementOutputCount, + "incrementOutputCount", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::OutputComplete, + "OutputComplete", + OCC::OutputComplete, + "outputComplete", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::GetInputRecordCount, + "GetInputRecordCount", + OCC::GetInputRecordCount, + "getInputRecordCount", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {}}, + {OC::FinishedCrossGroupSharing, + "FinishedCrossGroupSharing", + OCC::FinishedCrossGroupSharing, + "finishedCrossGroupSharing", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, // Synchronization void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::BarrierByMemoryType, - "BarrierByMemoryType", - OCC::BarrierByMemoryType, - "barrierByMemoryType", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::NoDuplicate, - }, - { - OC::BarrierByMemoryHandle, - "BarrierByMemoryHandle", - OCC::BarrierByMemoryHandle, - "barrierByMemoryHandle", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::NoDuplicate, - }, - { - OC::BarrierByNodeRecordHandle, - "BarrierByNodeRecordHandle", - OCC::BarrierByNodeRecordHandle, - "barrierByNodeRecordHandle", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::NoDuplicate, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::BarrierByMemoryType, + "BarrierByMemoryType", + OCC::BarrierByMemoryType, + "barrierByMemoryType", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::NoDuplicate, + {}, + {}}, + {OC::BarrierByMemoryHandle, + "BarrierByMemoryHandle", + OCC::BarrierByMemoryHandle, + "barrierByMemoryHandle", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::NoDuplicate, + {}, + {}}, + {OC::BarrierByNodeRecordHandle, + "BarrierByNodeRecordHandle", + OCC::BarrierByNodeRecordHandle, + "barrierByNodeRecordHandle", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::NoDuplicate, + {}, + {}}, // Create/Annotate Node Handles void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj, vec, function attribute - { - OC::CreateNodeOutputHandle, - "CreateNodeOutputHandle", - OCC::createNodeOutputHandle, - "createNodeOutputHandle", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::IndexNodeHandle, - "IndexNodeHandle", - OCC::IndexNodeHandle, - "indexNodeHandle", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::AnnotateNodeHandle, - "AnnotateNodeHandle", - OCC::AnnotateNodeHandle, - "annotateNodeHandle", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::CreateNodeInputRecordHandle, - "CreateNodeInputRecordHandle", - OCC::CreateNodeInputRecordHandle, - "createNodeInputRecordHandle", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::AnnotateNodeRecordHandle, - "AnnotateNodeRecordHandle", - OCC::AnnotateNodeRecordHandle, - "annotateNodeRecordHandle", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadNone, - }, + // i16, i32, i64, udt, obj, vec, function attribute, ext oload, + // vec oload + {OC::CreateNodeOutputHandle, + "CreateNodeOutputHandle", + OCC::createNodeOutputHandle, + "createNodeOutputHandle", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {}}, + {OC::IndexNodeHandle, + "IndexNodeHandle", + OCC::IndexNodeHandle, + "indexNodeHandle", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {}}, + {OC::AnnotateNodeHandle, + "AnnotateNodeHandle", + OCC::AnnotateNodeHandle, + "annotateNodeHandle", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {}}, + {OC::CreateNodeInputRecordHandle, + "CreateNodeInputRecordHandle", + OCC::CreateNodeInputRecordHandle, + "createNodeInputRecordHandle", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {}}, + {OC::AnnotateNodeRecordHandle, + "AnnotateNodeRecordHandle", + OCC::AnnotateNodeRecordHandle, + "annotateNodeRecordHandle", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {}}, // Work Graph intrinsics void, h, f, d, i1, i8, i16, - // i32, i64, udt, obj, vec, function attribute - { - OC::NodeOutputIsValid, - "NodeOutputIsValid", - OCC::NodeOutputIsValid, - "nodeOutputIsValid", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::GetRemainingRecursionLevels, - "GetRemainingRecursionLevels", - OCC::GetRemainingRecursionLevels, - "getRemainingRecursionLevels", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, + // i32, i64, udt, obj, vec, function attribute, ext oload, vec + // oload + {OC::NodeOutputIsValid, + "NodeOutputIsValid", + OCC::NodeOutputIsValid, + "nodeOutputIsValid", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {}}, + {OC::GetRemainingRecursionLevels, + "GetRemainingRecursionLevels", + OCC::GetRemainingRecursionLevels, + "getRemainingRecursionLevels", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::ReadOnly, + {}, + {}}, // Comparison Samples void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::SampleCmpGrad, - "SampleCmpGrad", - OCC::SampleCmpGrad, - "sampleCmpGrad", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, - { - OC::SampleCmpBias, - "SampleCmpBias", - OCC::SampleCmpBias, - "sampleCmpBias", - {false, true, true, false, false, false, false, false, false, false, - false, false}, - Attribute::ReadOnly, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::SampleCmpGrad, + "SampleCmpGrad", + OCC::SampleCmpGrad, + "sampleCmpGrad", + {false, true, true, false, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, + {OC::SampleCmpBias, + "SampleCmpBias", + OCC::SampleCmpBias, + "sampleCmpBias", + {false, true, true, false, false, false, false, false, false, false, false, + false, false}, + Attribute::ReadOnly, + {}, + {0x00}}, // Extended Command Information void, h, f, d, i1, i8, - // i16, i32, i64, udt, obj, vec, function attribute - { - OC::StartVertexLocation, - "StartVertexLocation", - OCC::StartVertexLocation, - "startVertexLocation", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, - { - OC::StartInstanceLocation, - "StartInstanceLocation", - OCC::StartInstanceLocation, - "startInstanceLocation", - {false, false, false, false, false, false, false, true, false, false, - false, false}, - Attribute::ReadNone, - }, + // i16, i32, i64, udt, obj, vec, function attribute, ext oload, + // vec oload + {OC::StartVertexLocation, + "StartVertexLocation", + OCC::StartVertexLocation, + "startVertexLocation", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, + {OC::StartInstanceLocation, + "StartInstanceLocation", + OCC::StartInstanceLocation, + "startInstanceLocation", + {false, false, false, false, false, false, false, true, false, false, + false, false, false}, + Attribute::ReadNone, + {}, + {0x00}}, // Inline Ray Query void, h, f, d, i1, i8, i16, i32, - // i64, udt, obj, vec, function attribute - { - OC::AllocateRayQuery2, - "AllocateRayQuery2", - OCC::AllocateRayQuery2, - "allocateRayQuery2", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - - // void, h, f, d, i1, i8, i16, i32, i64, udt, obj, vec, function attribute - { - OC::ReservedA0, - "ReservedA0", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedA1, - "ReservedA1", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedA2, - "ReservedA2", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB0, - "ReservedB0", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB1, - "ReservedB1", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB2, - "ReservedB2", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB3, - "ReservedB3", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB4, - "ReservedB4", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB5, - "ReservedB5", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB6, - "ReservedB6", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB7, - "ReservedB7", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB8, - "ReservedB8", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB9, - "ReservedB9", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB10, - "ReservedB10", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB11, - "ReservedB11", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB12, - "ReservedB12", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB13, - "ReservedB13", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB14, - "ReservedB14", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB15, - "ReservedB15", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB16, - "ReservedB16", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB17, - "ReservedB17", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB18, - "ReservedB18", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB19, - "ReservedB19", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB20, - "ReservedB20", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB21, - "ReservedB21", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB22, - "ReservedB22", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB23, - "ReservedB23", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB24, - "ReservedB24", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB25, - "ReservedB25", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB26, - "ReservedB26", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB27, - "ReservedB27", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB28, - "ReservedB28", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB29, - "ReservedB29", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedB30, - "ReservedB30", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedC0, - "ReservedC0", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedC1, - "ReservedC1", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedC2, - "ReservedC2", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedC3, - "ReservedC3", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedC4, - "ReservedC4", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedC5, - "ReservedC5", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedC6, - "ReservedC6", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedC7, - "ReservedC7", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedC8, - "ReservedC8", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::ReservedC9, - "ReservedC9", - OCC::Reserved, - "reserved", - {true, false, false, false, false, false, false, false, false, false, - false, false}, - Attribute::None, - }, - { - OC::RawBufferVectorLoad, - "RawBufferVectorLoad", - OCC::RawBufferVectorLoad, - "rawBufferVectorLoad", - {false, false, false, false, false, false, false, false, false, false, - false, true}, - Attribute::ReadOnly, - }, - { - OC::RawBufferVectorStore, - "RawBufferVectorStore", - OCC::RawBufferVectorStore, - "rawBufferVectorStore", - {false, false, false, false, false, false, false, false, false, false, - false, true}, - Attribute::None, - }, + // i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::AllocateRayQuery2, + "AllocateRayQuery2", + OCC::AllocateRayQuery2, + "allocateRayQuery2", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + + // void, h, f, d, i1, i8, i16, i32, i64, udt, obj, vec, function attribute, ext oload, vec oload + {OC::ReservedA0, + "ReservedA0", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedA1, + "ReservedA1", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedA2, + "ReservedA2", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB0, + "ReservedB0", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB1, + "ReservedB1", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB2, + "ReservedB2", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB3, + "ReservedB3", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB4, + "ReservedB4", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB5, + "ReservedB5", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB6, + "ReservedB6", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB7, + "ReservedB7", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB8, + "ReservedB8", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB9, + "ReservedB9", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB10, + "ReservedB10", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB11, + "ReservedB11", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB12, + "ReservedB12", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB13, + "ReservedB13", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB14, + "ReservedB14", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB15, + "ReservedB15", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB16, + "ReservedB16", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB17, + "ReservedB17", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB18, + "ReservedB18", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB19, + "ReservedB19", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB20, + "ReservedB20", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB21, + "ReservedB21", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB22, + "ReservedB22", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB23, + "ReservedB23", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB24, + "ReservedB24", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB25, + "ReservedB25", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB26, + "ReservedB26", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB27, + "ReservedB27", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB28, + "ReservedB28", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB29, + "ReservedB29", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedB30, + "ReservedB30", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedC0, + "ReservedC0", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedC1, + "ReservedC1", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedC2, + "ReservedC2", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedC3, + "ReservedC3", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedC4, + "ReservedC4", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedC5, + "ReservedC5", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedC6, + "ReservedC6", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedC7, + "ReservedC7", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedC8, + "ReservedC8", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::ReservedC9, + "ReservedC9", + OCC::Reserved, + "reserved", + {true, false, false, false, false, false, false, false, false, false, + false, false, false}, + Attribute::None, + {}, + {}}, + {OC::RawBufferVectorLoad, + "RawBufferVectorLoad", + OCC::RawBufferVectorLoad, + "rawBufferVectorLoad", + {false, true, true, true, false, false, true, true, true, false, false, + true, false}, + Attribute::ReadOnly, + {}, + {0x1ce}}, + {OC::RawBufferVectorStore, + "RawBufferVectorStore", + OCC::RawBufferVectorStore, + "rawBufferVectorStore", + {false, true, true, true, false, false, true, true, true, false, false, + true, false}, + Attribute::None, + {}, + {0x1ce}}, }; // OPCODE-OLOADS:END From 645e24bb98769c0dd9bb4a9d070d1324909c135f Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Fri, 21 Mar 2025 20:23:07 -0700 Subject: [PATCH 41/45] REVISED: Add extended and vector overload support for DXIL This is just the diffs for the new version that was meant to fix the warnings --- utils/hct/hctdb.py | 18 ++++++++++-------- utils/hct/hctdb_instrhelp.py | 15 ++------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 05f45600f2..5352e4d839 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -107,6 +107,7 @@ def __init__(self, name, **kwargs): self.ops = [] # the operands that this instruction takes self.is_allowed = True # whether this instruction is allowed in a DXIL program self.oload_types = "" # overload types if applicable + # Always call process_oload_types() after setting oload_types. self.extended_oload_types = None # extended overload types if applicable self.vector_oload_types = None # vector overload types if applicable self.fn_attr = "" # attribute shorthands: rn=does not access memory,ro=only reads from memory, @@ -140,8 +141,15 @@ def process_oload_types(self): raise ValueError( f"overload for '{self.name}' should be a string - use empty if n/a" ) - # Early out for LLVM instructions or void overloads. - if self.oload_types == "v" or not self.is_dxil_op: + # Early out for LLVM instructions + if not self.is_dxil_op: + return + + self.extended_oload_types = [""] * dxil_max_overload_dims + self.vector_oload_types = [""] * dxil_max_overload_dims + + # Early out for void overloads. + if self.oload_types == "v": return if self.oload_types == "": @@ -186,7 +194,6 @@ def process_oload_types(self): "Too many overload dimensions for DXIL op " f"{self.name}: '{self.oload_types}'" ) - self.vector_oload_types = [""] * len(oload_types) for n, oloads in enumerate(oload_types): if len(oloads) == 0: raise ValueError( @@ -225,11 +232,6 @@ def process_oload_types(self): self.vector_oload_types[n] = vector_oloads if len(oload_types) > 1: self.oload_types = "x" - self.extended_oload_types = oload_types - self.check_extended_oload_ops() - else: - self.oload_types = oload_types[0] - self.extended_oload_types = None def check_extended_oload_ops(self): "Ensure ops has sequential extended overload references with $x0, $x1, etc." diff --git a/utils/hct/hctdb_instrhelp.py b/utils/hct/hctdb_instrhelp.py index 03e8be9e93..7e05d25356 100644 --- a/utils/hct/hctdb_instrhelp.py +++ b/utils/hct/hctdb_instrhelp.py @@ -546,25 +546,14 @@ def print_opfunc_props(self): oload_to_mask = lambda oload: sum( [1 << dxil_all_user_oload_chars.find(c) for c in oload] ) - maybe_oloads_fn = lambda oloads: oloads if oloads else [] ext_oload_fn = ( lambda i: "{" - + ",".join( - [ - "0x%02x" % oload_to_mask(o) - for o in maybe_oloads_fn(i.extended_oload_types) - ] - ) + + ",".join(["0x%x" % oload_to_mask(o) for o in i.extended_oload_types]) + "}" ) vec_oload_fn = ( lambda i: "{" - + ",".join( - [ - "0x%02x" % oload_to_mask(o) - for o in maybe_oloads_fn(i.vector_oload_types) - ] - ) + + ",".join(["0x%x" % oload_to_mask(o) for o in i.vector_oload_types]) + "}" ) for i in self.instrs: From 9fb3d830ff42c311e8c4bd34be982365227a8441 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Tue, 25 Mar 2025 19:09:39 -0600 Subject: [PATCH 42/45] regenerate DxilOperations.cpp --- lib/DXIL/DxilOperations.cpp | 1220 +++++++++++++++++------------------ 1 file changed, 610 insertions(+), 610 deletions(-) diff --git a/lib/DXIL/DxilOperations.cpp b/lib/DXIL/DxilOperations.cpp index 41c3d21e2b..a2d3964077 100644 --- a/lib/DXIL/DxilOperations.cpp +++ b/lib/DXIL/DxilOperations.cpp @@ -55,8 +55,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::TempRegStore, "TempRegStore", OCC::TempRegStore, @@ -64,8 +64,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::MinPrecXRegLoad, "MinPrecXRegLoad", OCC::MinPrecXRegLoad, @@ -73,8 +73,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, false, false, false, false, true, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::MinPrecXRegStore, "MinPrecXRegStore", OCC::MinPrecXRegStore, @@ -82,8 +82,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, false, false, false, false, true, false, false, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::LoadInput, "LoadInput", OCC::LoadInput, @@ -91,8 +91,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::StoreOutput, "StoreOutput", OCC::StoreOutput, @@ -100,8 +100,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Unary float void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -112,8 +112,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Saturate, "Saturate", OCC::Unary, @@ -121,8 +121,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::IsNaN, "IsNaN", OCC::IsSpecialFloat, @@ -130,8 +130,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::IsInf, "IsInf", OCC::IsSpecialFloat, @@ -139,8 +139,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::IsFinite, "IsFinite", OCC::IsSpecialFloat, @@ -148,8 +148,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::IsNormal, "IsNormal", OCC::IsSpecialFloat, @@ -157,8 +157,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Cos, "Cos", OCC::Unary, @@ -166,8 +166,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x06}}, + {0x0, 0x0}, + {0x6, 0x0}}, {OC::Sin, "Sin", OCC::Unary, @@ -175,8 +175,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x06}}, + {0x0, 0x0}, + {0x6, 0x0}}, {OC::Tan, "Tan", OCC::Unary, @@ -184,8 +184,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x06}}, + {0x0, 0x0}, + {0x6, 0x0}}, {OC::Acos, "Acos", OCC::Unary, @@ -193,8 +193,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x06}}, + {0x0, 0x0}, + {0x6, 0x0}}, {OC::Asin, "Asin", OCC::Unary, @@ -202,8 +202,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x06}}, + {0x0, 0x0}, + {0x6, 0x0}}, {OC::Atan, "Atan", OCC::Unary, @@ -211,8 +211,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x06}}, + {0x0, 0x0}, + {0x6, 0x0}}, {OC::Hcos, "Hcos", OCC::Unary, @@ -220,8 +220,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x06}}, + {0x0, 0x0}, + {0x6, 0x0}}, {OC::Hsin, "Hsin", OCC::Unary, @@ -229,8 +229,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x06}}, + {0x0, 0x0}, + {0x6, 0x0}}, {OC::Htan, "Htan", OCC::Unary, @@ -238,8 +238,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x06}}, + {0x0, 0x0}, + {0x6, 0x0}}, {OC::Exp, "Exp", OCC::Unary, @@ -247,8 +247,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x06}}, + {0x0, 0x0}, + {0x6, 0x0}}, {OC::Frc, "Frc", OCC::Unary, @@ -256,8 +256,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x06}}, + {0x0, 0x0}, + {0x6, 0x0}}, {OC::Log, "Log", OCC::Unary, @@ -265,8 +265,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x06}}, + {0x0, 0x0}, + {0x6, 0x0}}, {OC::Sqrt, "Sqrt", OCC::Unary, @@ -274,8 +274,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x06}}, + {0x0, 0x0}, + {0x6, 0x0}}, {OC::Rsqrt, "Rsqrt", OCC::Unary, @@ -283,8 +283,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x06}}, + {0x0, 0x0}, + {0x6, 0x0}}, // Unary float - rounding void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -296,8 +296,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x06}}, + {0x0, 0x0}, + {0x6, 0x0}}, {OC::Round_ni, "Round_ni", OCC::Unary, @@ -305,8 +305,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x06}}, + {0x0, 0x0}, + {0x6, 0x0}}, {OC::Round_pi, "Round_pi", OCC::Unary, @@ -314,8 +314,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x06}}, + {0x0, 0x0}, + {0x6, 0x0}}, {OC::Round_z, "Round_z", OCC::Unary, @@ -323,8 +323,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x06}}, + {0x0, 0x0}, + {0x6, 0x0}}, // Unary int void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -335,8 +335,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Countbits, "Countbits", OCC::UnaryBits, @@ -344,8 +344,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::FirstbitLo, "FirstbitLo", OCC::UnaryBits, @@ -353,8 +353,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Unary uint void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -365,8 +365,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Unary int void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -377,8 +377,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Binary float void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -389,8 +389,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x0e}}, + {0x0, 0x0}, + {0xe, 0x0}}, {OC::FMin, "FMin", OCC::Binary, @@ -398,8 +398,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x0e}}, + {0x0, 0x0}, + {0xe, 0x0}}, // Binary int void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -410,8 +410,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, true, false}, Attribute::ReadNone, - {}, - {0x1c0}}, + {0x0, 0x0}, + {0x1c0, 0x0}}, {OC::IMin, "IMin", OCC::Binary, @@ -419,8 +419,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, true, false}, Attribute::ReadNone, - {}, - {0x1c0}}, + {0x0, 0x0}, + {0x1c0, 0x0}}, // Binary uint void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -431,8 +431,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, true, false}, Attribute::ReadNone, - {}, - {0x1c0}}, + {0x0, 0x0}, + {0x1c0, 0x0}}, {OC::UMin, "UMin", OCC::Binary, @@ -440,8 +440,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, true, false}, Attribute::ReadNone, - {}, - {0x1c0}}, + {0x0, 0x0}, + {0x1c0, 0x0}}, // Binary int with two outputs void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -453,8 +453,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Binary uint with two outputs void, h, f, d, i1, i8, // i16, i32, i64, udt, obj, vec, function attribute, ext oload, @@ -466,8 +466,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::UDiv, "UDiv", OCC::BinaryWithTwoOuts, @@ -475,8 +475,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Binary uint with carry or borrow void, h, f, d, i1, i8, // i16, i32, i64, udt, obj, vec, function attribute, ext oload, @@ -488,8 +488,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::USubb, "USubb", OCC::BinaryWithCarryOrBorrow, @@ -497,8 +497,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Tertiary float void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -509,8 +509,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Fma, "Fma", OCC::Tertiary, @@ -518,8 +518,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, true, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {}, - {0x08}}, + {0x0, 0x0}, + {0x8, 0x0}}, // Tertiary int void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -530,8 +530,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Tertiary uint void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -542,8 +542,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Tertiary int void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -554,8 +554,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, true, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Ibfe, "Ibfe", OCC::Tertiary, @@ -563,8 +563,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, true, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Tertiary uint void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -575,8 +575,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, true, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Quaternary void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -587,8 +587,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Dot void, h, f, d, i1, i8, i16, i32, i64, udt, // obj, vec, function attribute, ext oload, vec oload @@ -599,8 +599,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Dot3, "Dot3", OCC::Dot3, @@ -608,8 +608,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Dot4, "Dot4", OCC::Dot4, @@ -617,8 +617,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Resources void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -629,8 +629,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::CBufferLoad, "CBufferLoad", OCC::CBufferLoad, @@ -638,8 +638,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, true, true, true, true, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::CBufferLoadLegacy, "CBufferLoadLegacy", OCC::CBufferLoadLegacy, @@ -647,8 +647,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, false, true, true, true, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Resources - sample void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -659,8 +659,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::SampleBias, "SampleBias", OCC::SampleBias, @@ -668,8 +668,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::SampleLevel, "SampleLevel", OCC::SampleLevel, @@ -677,8 +677,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::SampleGrad, "SampleGrad", OCC::SampleGrad, @@ -686,8 +686,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::SampleCmp, "SampleCmp", OCC::SampleCmp, @@ -695,8 +695,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::SampleCmpLevelZero, "SampleCmpLevelZero", OCC::SampleCmpLevelZero, @@ -704,8 +704,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Resources void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -716,8 +716,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::TextureStore, "TextureStore", OCC::TextureStore, @@ -725,8 +725,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::BufferLoad, "BufferLoad", OCC::BufferLoad, @@ -734,8 +734,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::BufferStore, "BufferStore", OCC::BufferStore, @@ -743,8 +743,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::BufferUpdateCounter, "BufferUpdateCounter", OCC::BufferUpdateCounter, @@ -752,8 +752,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::CheckAccessFullyMapped, "CheckAccessFullyMapped", OCC::CheckAccessFullyMapped, @@ -761,8 +761,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::GetDimensions, "GetDimensions", OCC::GetDimensions, @@ -770,8 +770,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Resources - gather void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -782,8 +782,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::TextureGatherCmp, "TextureGatherCmp", OCC::TextureGatherCmp, @@ -791,8 +791,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Resources - sample void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -803,8 +803,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RenderTargetGetSamplePosition, "RenderTargetGetSamplePosition", OCC::RenderTargetGetSamplePosition, @@ -812,8 +812,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RenderTargetGetSampleCount, "RenderTargetGetSampleCount", OCC::RenderTargetGetSampleCount, @@ -821,8 +821,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Synchronization void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -833,8 +833,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, true, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::AtomicCompareExchange, "AtomicCompareExchange", OCC::AtomicCompareExchange, @@ -842,8 +842,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, true, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Barrier, "Barrier", OCC::Barrier, @@ -851,8 +851,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::NoDuplicate, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Derivatives void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -863,8 +863,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Pixel shader void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -875,8 +875,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Derivatives void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -887,8 +887,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::DerivCoarseY, "DerivCoarseY", OCC::Unary, @@ -896,8 +896,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::DerivFineX, "DerivFineX", OCC::Unary, @@ -905,8 +905,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::DerivFineY, "DerivFineY", OCC::Unary, @@ -914,8 +914,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Pixel shader void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -926,8 +926,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::EvalSampleIndex, "EvalSampleIndex", OCC::EvalSampleIndex, @@ -935,8 +935,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::EvalCentroid, "EvalCentroid", OCC::EvalCentroid, @@ -944,8 +944,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::SampleIndex, "SampleIndex", OCC::SampleIndex, @@ -953,8 +953,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Coverage, "Coverage", OCC::Coverage, @@ -962,8 +962,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::InnerCoverage, "InnerCoverage", OCC::InnerCoverage, @@ -971,8 +971,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Compute/Mesh/Amplification/Node shader void, h, f, d, i1, // i8, i16, i32, i64, udt, obj, vec, function attribute, ext @@ -984,8 +984,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::GroupId, "GroupId", OCC::GroupId, @@ -993,8 +993,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ThreadIdInGroup, "ThreadIdInGroup", OCC::ThreadIdInGroup, @@ -1002,8 +1002,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::FlattenedThreadIdInGroup, "FlattenedThreadIdInGroup", OCC::FlattenedThreadIdInGroup, @@ -1011,8 +1011,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Geometry shader void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -1023,8 +1023,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::CutStream, "CutStream", OCC::CutStream, @@ -1032,8 +1032,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::EmitThenCutStream, "EmitThenCutStream", OCC::EmitThenCutStream, @@ -1041,8 +1041,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::GSInstanceID, "GSInstanceID", OCC::GSInstanceID, @@ -1050,8 +1050,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Double precision void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -1062,8 +1062,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, true, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::SplitDouble, "SplitDouble", OCC::SplitDouble, @@ -1071,8 +1071,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, true, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Domain and hull shader void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -1084,8 +1084,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::LoadPatchConstant, "LoadPatchConstant", OCC::LoadPatchConstant, @@ -1093,8 +1093,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Domain shader void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -1105,8 +1105,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Hull shader void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -1117,8 +1117,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::OutputControlPointID, "OutputControlPointID", OCC::OutputControlPointID, @@ -1126,8 +1126,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Hull, Domain and Geometry shaders void, h, f, d, i1, i8, // i16, i32, i64, udt, obj, vec, function attribute, ext oload, @@ -1139,8 +1139,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Other void, h, f, d, i1, i8, i16, i32, i64, udt, // obj, vec, function attribute, ext oload, vec oload @@ -1151,8 +1151,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Wave void, h, f, d, i1, i8, i16, i32, i64, udt, // obj, vec, function attribute, ext oload, vec oload @@ -1163,8 +1163,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::WaveGetLaneIndex, "WaveGetLaneIndex", OCC::WaveGetLaneIndex, @@ -1172,8 +1172,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::WaveGetLaneCount, "WaveGetLaneCount", OCC::WaveGetLaneCount, @@ -1181,8 +1181,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::WaveAnyTrue, "WaveAnyTrue", OCC::WaveAnyTrue, @@ -1190,8 +1190,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::WaveAllTrue, "WaveAllTrue", OCC::WaveAllTrue, @@ -1199,8 +1199,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::WaveActiveAllEqual, "WaveActiveAllEqual", OCC::WaveActiveAllEqual, @@ -1208,8 +1208,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, true, true, true, true, true, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::WaveActiveBallot, "WaveActiveBallot", OCC::WaveActiveBallot, @@ -1217,8 +1217,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::WaveReadLaneAt, "WaveReadLaneAt", OCC::WaveReadLaneAt, @@ -1226,8 +1226,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, true, true, true, true, true, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::WaveReadLaneFirst, "WaveReadLaneFirst", OCC::WaveReadLaneFirst, @@ -1235,8 +1235,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, true, true, true, true, true, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::WaveActiveOp, "WaveActiveOp", OCC::WaveActiveOp, @@ -1244,8 +1244,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, true, true, true, true, true, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::WaveActiveBit, "WaveActiveBit", OCC::WaveActiveBit, @@ -1253,8 +1253,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, true, true, true, true, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::WavePrefixOp, "WavePrefixOp", OCC::WavePrefixOp, @@ -1262,8 +1262,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, true, true, true, true, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Quad Wave Ops void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -1274,8 +1274,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, true, true, true, true, true, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::QuadOp, "QuadOp", OCC::QuadOp, @@ -1283,8 +1283,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, true, true, true, true, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Bitcasts with different sizes void, h, f, d, i1, i8, // i16, i32, i64, udt, obj, vec, function attribute, ext oload, @@ -1296,8 +1296,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::BitcastF16toI16, "BitcastF16toI16", OCC::BitcastF16toI16, @@ -1305,8 +1305,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::BitcastI32toF32, "BitcastI32toF32", OCC::BitcastI32toF32, @@ -1314,8 +1314,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::BitcastF32toI32, "BitcastF32toI32", OCC::BitcastF32toI32, @@ -1323,8 +1323,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::BitcastI64toF64, "BitcastI64toF64", OCC::BitcastI64toF64, @@ -1332,8 +1332,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::BitcastF64toI64, "BitcastF64toI64", OCC::BitcastF64toI64, @@ -1341,8 +1341,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Legacy floating-point void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -1354,8 +1354,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::LegacyF16ToF32, "LegacyF16ToF32", OCC::LegacyF16ToF32, @@ -1363,8 +1363,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Double precision void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -1375,8 +1375,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::LegacyDoubleToSInt32, "LegacyDoubleToSInt32", OCC::LegacyDoubleToSInt32, @@ -1384,8 +1384,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::LegacyDoubleToUInt32, "LegacyDoubleToUInt32", OCC::LegacyDoubleToUInt32, @@ -1393,8 +1393,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Wave void, h, f, d, i1, i8, i16, i32, i64, udt, // obj, vec, function attribute, ext oload, vec oload @@ -1405,8 +1405,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::WavePrefixBitCount, "WavePrefixBitCount", OCC::WavePrefixOp, @@ -1414,8 +1414,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Pixel shader void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -1426,8 +1426,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Graphics shader void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -1438,8 +1438,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Resources void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -1450,8 +1450,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, false, true, true, true, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RawBufferStore, "RawBufferStore", OCC::RawBufferStore, @@ -1459,8 +1459,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, false, true, true, true, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Raytracing object space uint System Values void, h, f, d, i1, // i8, i16, i32, i64, udt, obj, vec, function attribute, ext @@ -1472,8 +1472,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::InstanceIndex, "InstanceIndex", OCC::InstanceIndex, @@ -1481,8 +1481,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Raytracing hit uint System Values void, h, f, d, i1, i8, // i16, i32, i64, udt, obj, vec, function attribute, ext oload, @@ -1494,8 +1494,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Raytracing uint System Values void, h, f, d, i1, i8, // i16, i32, i64, udt, obj, vec, function attribute, ext oload, @@ -1507,8 +1507,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Ray Dispatch Arguments void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -1520,8 +1520,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::DispatchRaysDimensions, "DispatchRaysDimensions", OCC::DispatchRaysDimensions, @@ -1529,8 +1529,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Ray Vectors void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -1541,8 +1541,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::WorldRayDirection, "WorldRayDirection", OCC::WorldRayDirection, @@ -1550,8 +1550,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Ray object space Vectors void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -1563,8 +1563,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ObjectRayDirection, "ObjectRayDirection", OCC::ObjectRayDirection, @@ -1572,8 +1572,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Ray Transforms void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -1584,8 +1584,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::WorldToObject, "WorldToObject", OCC::WorldToObject, @@ -1593,8 +1593,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // RayT void, h, f, d, i1, i8, i16, i32, i64, udt, // obj, vec, function attribute, ext oload, vec oload @@ -1605,8 +1605,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayTCurrent, "RayTCurrent", OCC::RayTCurrent, @@ -1614,8 +1614,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // AnyHit Terminals void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -1626,8 +1626,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::NoReturn, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::AcceptHitAndEndSearch, "AcceptHitAndEndSearch", OCC::AcceptHitAndEndSearch, @@ -1635,8 +1635,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::NoReturn, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Indirect Shader Invocation void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -1648,8 +1648,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, false, false, true, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReportHit, "ReportHit", OCC::ReportHit, @@ -1657,8 +1657,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, false, false, true, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::CallShader, "CallShader", OCC::CallShader, @@ -1666,8 +1666,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, false, false, true, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Library create handle from resource struct (like HL intrinsic) void, h, // f, d, i1, i8, i16, i32, i64, udt, obj, vec, @@ -1679,8 +1679,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, false, false, false, true, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Raytracing object space uint System Values void, h, f, d, i1, // i8, i16, i32, i64, udt, obj, vec, function attribute, ext @@ -1692,8 +1692,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Dot product with accumulate void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -1705,8 +1705,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Dot4AddI8Packed, "Dot4AddI8Packed", OCC::Dot4AddPacked, @@ -1714,8 +1714,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Dot4AddU8Packed, "Dot4AddU8Packed", OCC::Dot4AddPacked, @@ -1723,8 +1723,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Wave void, h, f, d, i1, i8, i16, i32, i64, udt, // obj, vec, function attribute, ext oload, vec oload @@ -1735,8 +1735,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, true, true, true, true, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::WaveMultiPrefixOp, "WaveMultiPrefixOp", OCC::WaveMultiPrefixOp, @@ -1744,8 +1744,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, true, true, true, true, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::WaveMultiPrefixBitCount, "WaveMultiPrefixBitCount", OCC::WaveMultiPrefixBitCount, @@ -1753,8 +1753,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Mesh shader instructions void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -1766,8 +1766,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::EmitIndices, "EmitIndices", OCC::EmitIndices, @@ -1775,8 +1775,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::GetMeshPayload, "GetMeshPayload", OCC::GetMeshPayload, @@ -1784,8 +1784,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, false, false, true, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::StoreVertexOutput, "StoreVertexOutput", OCC::StoreVertexOutput, @@ -1793,8 +1793,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::StorePrimitiveOutput, "StorePrimitiveOutput", OCC::StorePrimitiveOutput, @@ -1802,8 +1802,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Amplification shader instructions void, h, f, d, i1, i8, // i16, i32, i64, udt, obj, vec, function attribute, ext oload, @@ -1815,8 +1815,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, false, false, true, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Sampler Feedback void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -1827,8 +1827,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::WriteSamplerFeedbackBias, "WriteSamplerFeedbackBias", OCC::WriteSamplerFeedbackBias, @@ -1836,8 +1836,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::WriteSamplerFeedbackLevel, "WriteSamplerFeedbackLevel", OCC::WriteSamplerFeedbackLevel, @@ -1845,8 +1845,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::WriteSamplerFeedbackGrad, "WriteSamplerFeedbackGrad", OCC::WriteSamplerFeedbackGrad, @@ -1854,8 +1854,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Inline Ray Query void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -1866,8 +1866,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_TraceRayInline, "RayQuery_TraceRayInline", OCC::RayQuery_TraceRayInline, @@ -1875,8 +1875,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_Proceed, "RayQuery_Proceed", OCC::RayQuery_Proceed, @@ -1884,8 +1884,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, true, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_Abort, "RayQuery_Abort", OCC::RayQuery_Abort, @@ -1893,8 +1893,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CommitNonOpaqueTriangleHit, "RayQuery_CommitNonOpaqueTriangleHit", OCC::RayQuery_CommitNonOpaqueTriangleHit, @@ -1902,8 +1902,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CommitProceduralPrimitiveHit, "RayQuery_CommitProceduralPrimitiveHit", OCC::RayQuery_CommitProceduralPrimitiveHit, @@ -1911,8 +1911,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CommittedStatus, "RayQuery_CommittedStatus", OCC::RayQuery_StateScalar, @@ -1920,8 +1920,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CandidateType, "RayQuery_CandidateType", OCC::RayQuery_StateScalar, @@ -1929,8 +1929,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CandidateObjectToWorld3x4, "RayQuery_CandidateObjectToWorld3x4", OCC::RayQuery_StateMatrix, @@ -1938,8 +1938,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CandidateWorldToObject3x4, "RayQuery_CandidateWorldToObject3x4", OCC::RayQuery_StateMatrix, @@ -1947,8 +1947,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CommittedObjectToWorld3x4, "RayQuery_CommittedObjectToWorld3x4", OCC::RayQuery_StateMatrix, @@ -1956,8 +1956,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CommittedWorldToObject3x4, "RayQuery_CommittedWorldToObject3x4", OCC::RayQuery_StateMatrix, @@ -1965,8 +1965,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CandidateProceduralPrimitiveNonOpaque, "RayQuery_CandidateProceduralPrimitiveNonOpaque", OCC::RayQuery_StateScalar, @@ -1974,8 +1974,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, true, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CandidateTriangleFrontFace, "RayQuery_CandidateTriangleFrontFace", OCC::RayQuery_StateScalar, @@ -1983,8 +1983,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, true, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CommittedTriangleFrontFace, "RayQuery_CommittedTriangleFrontFace", OCC::RayQuery_StateScalar, @@ -1992,8 +1992,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, true, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CandidateTriangleBarycentrics, "RayQuery_CandidateTriangleBarycentrics", OCC::RayQuery_StateVector, @@ -2001,8 +2001,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CommittedTriangleBarycentrics, "RayQuery_CommittedTriangleBarycentrics", OCC::RayQuery_StateVector, @@ -2010,8 +2010,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_RayFlags, "RayQuery_RayFlags", OCC::RayQuery_StateScalar, @@ -2019,8 +2019,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_WorldRayOrigin, "RayQuery_WorldRayOrigin", OCC::RayQuery_StateVector, @@ -2028,8 +2028,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_WorldRayDirection, "RayQuery_WorldRayDirection", OCC::RayQuery_StateVector, @@ -2037,8 +2037,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_RayTMin, "RayQuery_RayTMin", OCC::RayQuery_StateScalar, @@ -2046,8 +2046,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CandidateTriangleRayT, "RayQuery_CandidateTriangleRayT", OCC::RayQuery_StateScalar, @@ -2055,8 +2055,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CommittedRayT, "RayQuery_CommittedRayT", OCC::RayQuery_StateScalar, @@ -2064,8 +2064,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CandidateInstanceIndex, "RayQuery_CandidateInstanceIndex", OCC::RayQuery_StateScalar, @@ -2073,8 +2073,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CandidateInstanceID, "RayQuery_CandidateInstanceID", OCC::RayQuery_StateScalar, @@ -2082,8 +2082,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CandidateGeometryIndex, "RayQuery_CandidateGeometryIndex", OCC::RayQuery_StateScalar, @@ -2091,8 +2091,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CandidatePrimitiveIndex, "RayQuery_CandidatePrimitiveIndex", OCC::RayQuery_StateScalar, @@ -2100,8 +2100,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CandidateObjectRayOrigin, "RayQuery_CandidateObjectRayOrigin", OCC::RayQuery_StateVector, @@ -2109,8 +2109,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CandidateObjectRayDirection, "RayQuery_CandidateObjectRayDirection", OCC::RayQuery_StateVector, @@ -2118,8 +2118,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CommittedInstanceIndex, "RayQuery_CommittedInstanceIndex", OCC::RayQuery_StateScalar, @@ -2127,8 +2127,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CommittedInstanceID, "RayQuery_CommittedInstanceID", OCC::RayQuery_StateScalar, @@ -2136,8 +2136,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CommittedGeometryIndex, "RayQuery_CommittedGeometryIndex", OCC::RayQuery_StateScalar, @@ -2145,8 +2145,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CommittedPrimitiveIndex, "RayQuery_CommittedPrimitiveIndex", OCC::RayQuery_StateScalar, @@ -2154,8 +2154,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CommittedObjectRayOrigin, "RayQuery_CommittedObjectRayOrigin", OCC::RayQuery_StateVector, @@ -2163,8 +2163,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CommittedObjectRayDirection, "RayQuery_CommittedObjectRayDirection", OCC::RayQuery_StateVector, @@ -2172,8 +2172,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Raytracing object space uint System Values, raytracing tier 1.1 void, h, // f, d, i1, i8, i16, i32, i64, udt, obj, vec, @@ -2185,8 +2185,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Inline Ray Query void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -2197,8 +2197,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RayQuery_CommittedInstanceContributionToHitGroupIndex, "RayQuery_CommittedInstanceContributionToHitGroupIndex", OCC::RayQuery_StateScalar, @@ -2206,8 +2206,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Get handle from heap void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -2218,8 +2218,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::CreateHandleFromBinding, "CreateHandleFromBinding", OCC::CreateHandleFromBinding, @@ -2227,8 +2227,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::CreateHandleFromHeap, "CreateHandleFromHeap", OCC::CreateHandleFromHeap, @@ -2236,8 +2236,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Unpacking intrinsics void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -2248,8 +2248,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Packing intrinsics void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -2260,8 +2260,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Helper Lanes void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -2272,8 +2272,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, true, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Quad Wave Ops void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -2284,8 +2284,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, true, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Resources - gather void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -2296,8 +2296,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Resources - sample void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -2308,8 +2308,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Resources void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -2320,8 +2320,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::None, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // void, h, f, d, i1, i8, i16, i32, i64, udt, obj, vec, function attribute, ext oload, vec oload {OC::Reserved0, @@ -2331,8 +2331,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Reserved1, "Reserved1", OCC::Reserved, @@ -2340,8 +2340,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Reserved2, "Reserved2", OCC::Reserved, @@ -2349,8 +2349,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Reserved3, "Reserved3", OCC::Reserved, @@ -2358,8 +2358,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Reserved4, "Reserved4", OCC::Reserved, @@ -2367,8 +2367,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Reserved5, "Reserved5", OCC::Reserved, @@ -2376,8 +2376,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Reserved6, "Reserved6", OCC::Reserved, @@ -2385,8 +2385,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Reserved7, "Reserved7", OCC::Reserved, @@ -2394,8 +2394,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Reserved8, "Reserved8", OCC::Reserved, @@ -2403,8 +2403,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Reserved9, "Reserved9", OCC::Reserved, @@ -2412,8 +2412,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Reserved10, "Reserved10", OCC::Reserved, @@ -2421,8 +2421,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::Reserved11, "Reserved11", OCC::Reserved, @@ -2430,8 +2430,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Create/Annotate Node Handles void, h, f, d, i1, i8, // i16, i32, i64, udt, obj, vec, function attribute, ext oload, @@ -2443,8 +2443,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Get Pointer to Node Record in Address Space 6 void, h, f, d, // i1, i8, i16, i32, i64, udt, obj, vec, function attribute, @@ -2456,8 +2456,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, false, false, true, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Work Graph intrinsics void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -2469,8 +2469,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::OutputComplete, "OutputComplete", OCC::OutputComplete, @@ -2478,8 +2478,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::GetInputRecordCount, "GetInputRecordCount", OCC::GetInputRecordCount, @@ -2487,8 +2487,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::FinishedCrossGroupSharing, "FinishedCrossGroupSharing", OCC::FinishedCrossGroupSharing, @@ -2496,8 +2496,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Synchronization void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -2508,8 +2508,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::NoDuplicate, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::BarrierByMemoryHandle, "BarrierByMemoryHandle", OCC::BarrierByMemoryHandle, @@ -2517,8 +2517,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::NoDuplicate, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::BarrierByNodeRecordHandle, "BarrierByNodeRecordHandle", OCC::BarrierByNodeRecordHandle, @@ -2526,8 +2526,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::NoDuplicate, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Create/Annotate Node Handles void, h, f, d, i1, i8, // i16, i32, i64, udt, obj, vec, function attribute, ext oload, @@ -2539,8 +2539,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::IndexNodeHandle, "IndexNodeHandle", OCC::IndexNodeHandle, @@ -2548,8 +2548,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::AnnotateNodeHandle, "AnnotateNodeHandle", OCC::AnnotateNodeHandle, @@ -2557,8 +2557,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::CreateNodeInputRecordHandle, "CreateNodeInputRecordHandle", OCC::CreateNodeInputRecordHandle, @@ -2566,8 +2566,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::AnnotateNodeRecordHandle, "AnnotateNodeRecordHandle", OCC::AnnotateNodeRecordHandle, @@ -2575,8 +2575,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Work Graph intrinsics void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -2588,8 +2588,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::GetRemainingRecursionLevels, "GetRemainingRecursionLevels", OCC::GetRemainingRecursionLevels, @@ -2597,8 +2597,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Comparison Samples void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -2609,8 +2609,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::SampleCmpBias, "SampleCmpBias", OCC::SampleCmpBias, @@ -2618,8 +2618,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Extended Command Information void, h, f, d, i1, i8, // i16, i32, i64, udt, obj, vec, function attribute, ext oload, @@ -2631,8 +2631,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::StartInstanceLocation, "StartInstanceLocation", OCC::StartInstanceLocation, @@ -2640,8 +2640,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {}, - {0x00}}, + {0x0, 0x0}, + {0x0, 0x0}}, // Inline Ray Query void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -2652,8 +2652,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, // void, h, f, d, i1, i8, i16, i32, i64, udt, obj, vec, function attribute, ext oload, vec oload {OC::ReservedA0, @@ -2663,8 +2663,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedA1, "ReservedA1", OCC::Reserved, @@ -2672,8 +2672,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedA2, "ReservedA2", OCC::Reserved, @@ -2681,8 +2681,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB0, "ReservedB0", OCC::Reserved, @@ -2690,8 +2690,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB1, "ReservedB1", OCC::Reserved, @@ -2699,8 +2699,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB2, "ReservedB2", OCC::Reserved, @@ -2708,8 +2708,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB3, "ReservedB3", OCC::Reserved, @@ -2717,8 +2717,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB4, "ReservedB4", OCC::Reserved, @@ -2726,8 +2726,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB5, "ReservedB5", OCC::Reserved, @@ -2735,8 +2735,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB6, "ReservedB6", OCC::Reserved, @@ -2744,8 +2744,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB7, "ReservedB7", OCC::Reserved, @@ -2753,8 +2753,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB8, "ReservedB8", OCC::Reserved, @@ -2762,8 +2762,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB9, "ReservedB9", OCC::Reserved, @@ -2771,8 +2771,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB10, "ReservedB10", OCC::Reserved, @@ -2780,8 +2780,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB11, "ReservedB11", OCC::Reserved, @@ -2789,8 +2789,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB12, "ReservedB12", OCC::Reserved, @@ -2798,8 +2798,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB13, "ReservedB13", OCC::Reserved, @@ -2807,8 +2807,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB14, "ReservedB14", OCC::Reserved, @@ -2816,8 +2816,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB15, "ReservedB15", OCC::Reserved, @@ -2825,8 +2825,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB16, "ReservedB16", OCC::Reserved, @@ -2834,8 +2834,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB17, "ReservedB17", OCC::Reserved, @@ -2843,8 +2843,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB18, "ReservedB18", OCC::Reserved, @@ -2852,8 +2852,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB19, "ReservedB19", OCC::Reserved, @@ -2861,8 +2861,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB20, "ReservedB20", OCC::Reserved, @@ -2870,8 +2870,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB21, "ReservedB21", OCC::Reserved, @@ -2879,8 +2879,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB22, "ReservedB22", OCC::Reserved, @@ -2888,8 +2888,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB23, "ReservedB23", OCC::Reserved, @@ -2897,8 +2897,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB24, "ReservedB24", OCC::Reserved, @@ -2906,8 +2906,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB25, "ReservedB25", OCC::Reserved, @@ -2915,8 +2915,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB26, "ReservedB26", OCC::Reserved, @@ -2924,8 +2924,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB27, "ReservedB27", OCC::Reserved, @@ -2933,8 +2933,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB28, "ReservedB28", OCC::Reserved, @@ -2942,8 +2942,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB29, "ReservedB29", OCC::Reserved, @@ -2951,8 +2951,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedB30, "ReservedB30", OCC::Reserved, @@ -2960,8 +2960,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedC0, "ReservedC0", OCC::Reserved, @@ -2969,8 +2969,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedC1, "ReservedC1", OCC::Reserved, @@ -2978,8 +2978,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedC2, "ReservedC2", OCC::Reserved, @@ -2987,8 +2987,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedC3, "ReservedC3", OCC::Reserved, @@ -2996,8 +2996,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedC4, "ReservedC4", OCC::Reserved, @@ -3005,8 +3005,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedC5, "ReservedC5", OCC::Reserved, @@ -3014,8 +3014,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedC6, "ReservedC6", OCC::Reserved, @@ -3023,8 +3023,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedC7, "ReservedC7", OCC::Reserved, @@ -3032,8 +3032,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedC8, "ReservedC8", OCC::Reserved, @@ -3041,8 +3041,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::ReservedC9, "ReservedC9", OCC::Reserved, @@ -3050,8 +3050,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {}, - {}}, + {0x0, 0x0}, + {0x0, 0x0}}, {OC::RawBufferVectorLoad, "RawBufferVectorLoad", OCC::RawBufferVectorLoad, @@ -3059,8 +3059,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, false, true, true, true, false, false, true, false}, Attribute::ReadOnly, - {}, - {0x1ce}}, + {0x0, 0x0}, + {0x1ce, 0x0}}, {OC::RawBufferVectorStore, "RawBufferVectorStore", OCC::RawBufferVectorStore, @@ -3068,8 +3068,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, false, true, true, true, false, false, true, false}, Attribute::None, - {}, - {0x1ce}}, + {0x0, 0x0}, + {0x1ce, 0x0}}, }; // OPCODE-OLOADS:END From 0bc07ce6db749492514974b007d980c82943b995 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Tue, 25 Mar 2025 19:11:52 -0600 Subject: [PATCH 43/45] Fix warnings about missing braces in clang --- utils/hct/hctdb_instrhelp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/hct/hctdb_instrhelp.py b/utils/hct/hctdb_instrhelp.py index 7e05d25356..cf81dd04fc 100644 --- a/utils/hct/hctdb_instrhelp.py +++ b/utils/hct/hctdb_instrhelp.py @@ -548,12 +548,12 @@ def print_opfunc_props(self): ) ext_oload_fn = ( lambda i: "{" - + ",".join(["0x%x" % oload_to_mask(o) for o in i.extended_oload_types]) + + ",".join(["{0x%x}" % oload_to_mask(o) for o in i.extended_oload_types]) + "}" ) vec_oload_fn = ( lambda i: "{" - + ",".join(["0x%x" % oload_to_mask(o) for o in i.vector_oload_types]) + + ",".join(["{0x%x}" % oload_to_mask(o) for o in i.vector_oload_types]) + "}" ) for i in self.instrs: From 5bf2d911917342e7f037aa9f32c2c410a61d0191 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Tue, 25 Mar 2025 19:12:00 -0600 Subject: [PATCH 44/45] update Dxiloperations.cpp again --- lib/DXIL/DxilOperations.cpp | 1220 +++++++++++++++++------------------ 1 file changed, 610 insertions(+), 610 deletions(-) diff --git a/lib/DXIL/DxilOperations.cpp b/lib/DXIL/DxilOperations.cpp index a2d3964077..29ec115824 100644 --- a/lib/DXIL/DxilOperations.cpp +++ b/lib/DXIL/DxilOperations.cpp @@ -55,8 +55,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::TempRegStore, "TempRegStore", OCC::TempRegStore, @@ -64,8 +64,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::MinPrecXRegLoad, "MinPrecXRegLoad", OCC::MinPrecXRegLoad, @@ -73,8 +73,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, false, false, false, false, true, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::MinPrecXRegStore, "MinPrecXRegStore", OCC::MinPrecXRegStore, @@ -82,8 +82,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, false, false, false, false, true, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::LoadInput, "LoadInput", OCC::LoadInput, @@ -91,8 +91,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::StoreOutput, "StoreOutput", OCC::StoreOutput, @@ -100,8 +100,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Unary float void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -112,8 +112,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Saturate, "Saturate", OCC::Unary, @@ -121,8 +121,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::IsNaN, "IsNaN", OCC::IsSpecialFloat, @@ -130,8 +130,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::IsInf, "IsInf", OCC::IsSpecialFloat, @@ -139,8 +139,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::IsFinite, "IsFinite", OCC::IsSpecialFloat, @@ -148,8 +148,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::IsNormal, "IsNormal", OCC::IsSpecialFloat, @@ -157,8 +157,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Cos, "Cos", OCC::Unary, @@ -166,8 +166,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x6, 0x0}}, + {{0x0}, {0x0}}, + {{0x6}, {0x0}}}, {OC::Sin, "Sin", OCC::Unary, @@ -175,8 +175,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x6, 0x0}}, + {{0x0}, {0x0}}, + {{0x6}, {0x0}}}, {OC::Tan, "Tan", OCC::Unary, @@ -184,8 +184,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x6, 0x0}}, + {{0x0}, {0x0}}, + {{0x6}, {0x0}}}, {OC::Acos, "Acos", OCC::Unary, @@ -193,8 +193,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x6, 0x0}}, + {{0x0}, {0x0}}, + {{0x6}, {0x0}}}, {OC::Asin, "Asin", OCC::Unary, @@ -202,8 +202,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x6, 0x0}}, + {{0x0}, {0x0}}, + {{0x6}, {0x0}}}, {OC::Atan, "Atan", OCC::Unary, @@ -211,8 +211,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x6, 0x0}}, + {{0x0}, {0x0}}, + {{0x6}, {0x0}}}, {OC::Hcos, "Hcos", OCC::Unary, @@ -220,8 +220,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x6, 0x0}}, + {{0x0}, {0x0}}, + {{0x6}, {0x0}}}, {OC::Hsin, "Hsin", OCC::Unary, @@ -229,8 +229,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x6, 0x0}}, + {{0x0}, {0x0}}, + {{0x6}, {0x0}}}, {OC::Htan, "Htan", OCC::Unary, @@ -238,8 +238,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x6, 0x0}}, + {{0x0}, {0x0}}, + {{0x6}, {0x0}}}, {OC::Exp, "Exp", OCC::Unary, @@ -247,8 +247,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x6, 0x0}}, + {{0x0}, {0x0}}, + {{0x6}, {0x0}}}, {OC::Frc, "Frc", OCC::Unary, @@ -256,8 +256,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x6, 0x0}}, + {{0x0}, {0x0}}, + {{0x6}, {0x0}}}, {OC::Log, "Log", OCC::Unary, @@ -265,8 +265,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x6, 0x0}}, + {{0x0}, {0x0}}, + {{0x6}, {0x0}}}, {OC::Sqrt, "Sqrt", OCC::Unary, @@ -274,8 +274,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x6, 0x0}}, + {{0x0}, {0x0}}, + {{0x6}, {0x0}}}, {OC::Rsqrt, "Rsqrt", OCC::Unary, @@ -283,8 +283,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x6, 0x0}}, + {{0x0}, {0x0}}, + {{0x6}, {0x0}}}, // Unary float - rounding void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -296,8 +296,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x6, 0x0}}, + {{0x0}, {0x0}}, + {{0x6}, {0x0}}}, {OC::Round_ni, "Round_ni", OCC::Unary, @@ -305,8 +305,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x6, 0x0}}, + {{0x0}, {0x0}}, + {{0x6}, {0x0}}}, {OC::Round_pi, "Round_pi", OCC::Unary, @@ -314,8 +314,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x6, 0x0}}, + {{0x0}, {0x0}}, + {{0x6}, {0x0}}}, {OC::Round_z, "Round_z", OCC::Unary, @@ -323,8 +323,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x6, 0x0}}, + {{0x0}, {0x0}}, + {{0x6}, {0x0}}}, // Unary int void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -335,8 +335,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Countbits, "Countbits", OCC::UnaryBits, @@ -344,8 +344,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::FirstbitLo, "FirstbitLo", OCC::UnaryBits, @@ -353,8 +353,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Unary uint void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -365,8 +365,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Unary int void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -377,8 +377,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Binary float void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -389,8 +389,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0xe, 0x0}}, + {{0x0}, {0x0}}, + {{0xe}, {0x0}}}, {OC::FMin, "FMin", OCC::Binary, @@ -398,8 +398,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0xe, 0x0}}, + {{0x0}, {0x0}}, + {{0xe}, {0x0}}}, // Binary int void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -410,8 +410,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x1c0, 0x0}}, + {{0x0}, {0x0}}, + {{0x1c0}, {0x0}}}, {OC::IMin, "IMin", OCC::Binary, @@ -419,8 +419,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x1c0, 0x0}}, + {{0x0}, {0x0}}, + {{0x1c0}, {0x0}}}, // Binary uint void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -431,8 +431,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x1c0, 0x0}}, + {{0x0}, {0x0}}, + {{0x1c0}, {0x0}}}, {OC::UMin, "UMin", OCC::Binary, @@ -440,8 +440,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x1c0, 0x0}}, + {{0x0}, {0x0}}, + {{0x1c0}, {0x0}}}, // Binary int with two outputs void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -453,8 +453,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Binary uint with two outputs void, h, f, d, i1, i8, // i16, i32, i64, udt, obj, vec, function attribute, ext oload, @@ -466,8 +466,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::UDiv, "UDiv", OCC::BinaryWithTwoOuts, @@ -475,8 +475,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Binary uint with carry or borrow void, h, f, d, i1, i8, // i16, i32, i64, udt, obj, vec, function attribute, ext oload, @@ -488,8 +488,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::USubb, "USubb", OCC::BinaryWithCarryOrBorrow, @@ -497,8 +497,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Tertiary float void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -509,8 +509,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Fma, "Fma", OCC::Tertiary, @@ -518,8 +518,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, true, false, false, false, false, false, false, false, true, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x8, 0x0}}, + {{0x0}, {0x0}}, + {{0x8}, {0x0}}}, // Tertiary int void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -530,8 +530,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Tertiary uint void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -542,8 +542,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Tertiary int void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -554,8 +554,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, true, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Ibfe, "Ibfe", OCC::Tertiary, @@ -563,8 +563,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, true, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Tertiary uint void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -575,8 +575,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, true, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Quaternary void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -587,8 +587,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Dot void, h, f, d, i1, i8, i16, i32, i64, udt, // obj, vec, function attribute, ext oload, vec oload @@ -599,8 +599,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Dot3, "Dot3", OCC::Dot3, @@ -608,8 +608,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Dot4, "Dot4", OCC::Dot4, @@ -617,8 +617,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Resources void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -629,8 +629,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::CBufferLoad, "CBufferLoad", OCC::CBufferLoad, @@ -638,8 +638,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, true, true, true, true, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::CBufferLoadLegacy, "CBufferLoadLegacy", OCC::CBufferLoadLegacy, @@ -647,8 +647,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, false, true, true, true, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Resources - sample void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -659,8 +659,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::SampleBias, "SampleBias", OCC::SampleBias, @@ -668,8 +668,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::SampleLevel, "SampleLevel", OCC::SampleLevel, @@ -677,8 +677,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::SampleGrad, "SampleGrad", OCC::SampleGrad, @@ -686,8 +686,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::SampleCmp, "SampleCmp", OCC::SampleCmp, @@ -695,8 +695,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::SampleCmpLevelZero, "SampleCmpLevelZero", OCC::SampleCmpLevelZero, @@ -704,8 +704,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Resources void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -716,8 +716,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::TextureStore, "TextureStore", OCC::TextureStore, @@ -725,8 +725,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::BufferLoad, "BufferLoad", OCC::BufferLoad, @@ -734,8 +734,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::BufferStore, "BufferStore", OCC::BufferStore, @@ -743,8 +743,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::BufferUpdateCounter, "BufferUpdateCounter", OCC::BufferUpdateCounter, @@ -752,8 +752,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::CheckAccessFullyMapped, "CheckAccessFullyMapped", OCC::CheckAccessFullyMapped, @@ -761,8 +761,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::GetDimensions, "GetDimensions", OCC::GetDimensions, @@ -770,8 +770,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Resources - gather void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -782,8 +782,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::TextureGatherCmp, "TextureGatherCmp", OCC::TextureGatherCmp, @@ -791,8 +791,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Resources - sample void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -803,8 +803,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RenderTargetGetSamplePosition, "RenderTargetGetSamplePosition", OCC::RenderTargetGetSamplePosition, @@ -812,8 +812,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RenderTargetGetSampleCount, "RenderTargetGetSampleCount", OCC::RenderTargetGetSampleCount, @@ -821,8 +821,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Synchronization void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -833,8 +833,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, true, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::AtomicCompareExchange, "AtomicCompareExchange", OCC::AtomicCompareExchange, @@ -842,8 +842,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, true, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Barrier, "Barrier", OCC::Barrier, @@ -851,8 +851,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::NoDuplicate, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Derivatives void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -863,8 +863,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Pixel shader void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -875,8 +875,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Derivatives void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -887,8 +887,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::DerivCoarseY, "DerivCoarseY", OCC::Unary, @@ -896,8 +896,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::DerivFineX, "DerivFineX", OCC::Unary, @@ -905,8 +905,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::DerivFineY, "DerivFineY", OCC::Unary, @@ -914,8 +914,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Pixel shader void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -926,8 +926,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::EvalSampleIndex, "EvalSampleIndex", OCC::EvalSampleIndex, @@ -935,8 +935,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::EvalCentroid, "EvalCentroid", OCC::EvalCentroid, @@ -944,8 +944,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::SampleIndex, "SampleIndex", OCC::SampleIndex, @@ -953,8 +953,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Coverage, "Coverage", OCC::Coverage, @@ -962,8 +962,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::InnerCoverage, "InnerCoverage", OCC::InnerCoverage, @@ -971,8 +971,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Compute/Mesh/Amplification/Node shader void, h, f, d, i1, // i8, i16, i32, i64, udt, obj, vec, function attribute, ext @@ -984,8 +984,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::GroupId, "GroupId", OCC::GroupId, @@ -993,8 +993,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ThreadIdInGroup, "ThreadIdInGroup", OCC::ThreadIdInGroup, @@ -1002,8 +1002,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::FlattenedThreadIdInGroup, "FlattenedThreadIdInGroup", OCC::FlattenedThreadIdInGroup, @@ -1011,8 +1011,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Geometry shader void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -1023,8 +1023,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::CutStream, "CutStream", OCC::CutStream, @@ -1032,8 +1032,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::EmitThenCutStream, "EmitThenCutStream", OCC::EmitThenCutStream, @@ -1041,8 +1041,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::GSInstanceID, "GSInstanceID", OCC::GSInstanceID, @@ -1050,8 +1050,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Double precision void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -1062,8 +1062,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, true, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::SplitDouble, "SplitDouble", OCC::SplitDouble, @@ -1071,8 +1071,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, true, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Domain and hull shader void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -1084,8 +1084,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::LoadPatchConstant, "LoadPatchConstant", OCC::LoadPatchConstant, @@ -1093,8 +1093,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Domain shader void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -1105,8 +1105,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Hull shader void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -1117,8 +1117,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::OutputControlPointID, "OutputControlPointID", OCC::OutputControlPointID, @@ -1126,8 +1126,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Hull, Domain and Geometry shaders void, h, f, d, i1, i8, // i16, i32, i64, udt, obj, vec, function attribute, ext oload, @@ -1139,8 +1139,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Other void, h, f, d, i1, i8, i16, i32, i64, udt, // obj, vec, function attribute, ext oload, vec oload @@ -1151,8 +1151,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Wave void, h, f, d, i1, i8, i16, i32, i64, udt, // obj, vec, function attribute, ext oload, vec oload @@ -1163,8 +1163,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::WaveGetLaneIndex, "WaveGetLaneIndex", OCC::WaveGetLaneIndex, @@ -1172,8 +1172,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::WaveGetLaneCount, "WaveGetLaneCount", OCC::WaveGetLaneCount, @@ -1181,8 +1181,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::WaveAnyTrue, "WaveAnyTrue", OCC::WaveAnyTrue, @@ -1190,8 +1190,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::WaveAllTrue, "WaveAllTrue", OCC::WaveAllTrue, @@ -1199,8 +1199,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::WaveActiveAllEqual, "WaveActiveAllEqual", OCC::WaveActiveAllEqual, @@ -1208,8 +1208,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, true, true, true, true, true, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::WaveActiveBallot, "WaveActiveBallot", OCC::WaveActiveBallot, @@ -1217,8 +1217,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::WaveReadLaneAt, "WaveReadLaneAt", OCC::WaveReadLaneAt, @@ -1226,8 +1226,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, true, true, true, true, true, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::WaveReadLaneFirst, "WaveReadLaneFirst", OCC::WaveReadLaneFirst, @@ -1235,8 +1235,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, true, true, true, true, true, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::WaveActiveOp, "WaveActiveOp", OCC::WaveActiveOp, @@ -1244,8 +1244,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, true, true, true, true, true, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::WaveActiveBit, "WaveActiveBit", OCC::WaveActiveBit, @@ -1253,8 +1253,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, true, true, true, true, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::WavePrefixOp, "WavePrefixOp", OCC::WavePrefixOp, @@ -1262,8 +1262,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, true, true, true, true, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Quad Wave Ops void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -1274,8 +1274,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, true, true, true, true, true, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::QuadOp, "QuadOp", OCC::QuadOp, @@ -1283,8 +1283,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, true, true, true, true, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Bitcasts with different sizes void, h, f, d, i1, i8, // i16, i32, i64, udt, obj, vec, function attribute, ext oload, @@ -1296,8 +1296,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::BitcastF16toI16, "BitcastF16toI16", OCC::BitcastF16toI16, @@ -1305,8 +1305,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::BitcastI32toF32, "BitcastI32toF32", OCC::BitcastI32toF32, @@ -1314,8 +1314,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::BitcastF32toI32, "BitcastF32toI32", OCC::BitcastF32toI32, @@ -1323,8 +1323,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::BitcastI64toF64, "BitcastI64toF64", OCC::BitcastI64toF64, @@ -1332,8 +1332,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::BitcastF64toI64, "BitcastF64toI64", OCC::BitcastF64toI64, @@ -1341,8 +1341,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Legacy floating-point void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -1354,8 +1354,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::LegacyF16ToF32, "LegacyF16ToF32", OCC::LegacyF16ToF32, @@ -1363,8 +1363,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Double precision void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -1375,8 +1375,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::LegacyDoubleToSInt32, "LegacyDoubleToSInt32", OCC::LegacyDoubleToSInt32, @@ -1384,8 +1384,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::LegacyDoubleToUInt32, "LegacyDoubleToUInt32", OCC::LegacyDoubleToUInt32, @@ -1393,8 +1393,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Wave void, h, f, d, i1, i8, i16, i32, i64, udt, // obj, vec, function attribute, ext oload, vec oload @@ -1405,8 +1405,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::WavePrefixBitCount, "WavePrefixBitCount", OCC::WavePrefixOp, @@ -1414,8 +1414,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Pixel shader void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -1426,8 +1426,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Graphics shader void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -1438,8 +1438,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Resources void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -1450,8 +1450,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, false, true, true, true, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RawBufferStore, "RawBufferStore", OCC::RawBufferStore, @@ -1459,8 +1459,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, false, true, true, true, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Raytracing object space uint System Values void, h, f, d, i1, // i8, i16, i32, i64, udt, obj, vec, function attribute, ext @@ -1472,8 +1472,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::InstanceIndex, "InstanceIndex", OCC::InstanceIndex, @@ -1481,8 +1481,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Raytracing hit uint System Values void, h, f, d, i1, i8, // i16, i32, i64, udt, obj, vec, function attribute, ext oload, @@ -1494,8 +1494,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Raytracing uint System Values void, h, f, d, i1, i8, // i16, i32, i64, udt, obj, vec, function attribute, ext oload, @@ -1507,8 +1507,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Ray Dispatch Arguments void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -1520,8 +1520,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::DispatchRaysDimensions, "DispatchRaysDimensions", OCC::DispatchRaysDimensions, @@ -1529,8 +1529,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Ray Vectors void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -1541,8 +1541,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::WorldRayDirection, "WorldRayDirection", OCC::WorldRayDirection, @@ -1550,8 +1550,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Ray object space Vectors void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -1563,8 +1563,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ObjectRayDirection, "ObjectRayDirection", OCC::ObjectRayDirection, @@ -1572,8 +1572,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Ray Transforms void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -1584,8 +1584,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::WorldToObject, "WorldToObject", OCC::WorldToObject, @@ -1593,8 +1593,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // RayT void, h, f, d, i1, i8, i16, i32, i64, udt, // obj, vec, function attribute, ext oload, vec oload @@ -1605,8 +1605,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayTCurrent, "RayTCurrent", OCC::RayTCurrent, @@ -1614,8 +1614,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // AnyHit Terminals void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -1626,8 +1626,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::NoReturn, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::AcceptHitAndEndSearch, "AcceptHitAndEndSearch", OCC::AcceptHitAndEndSearch, @@ -1635,8 +1635,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::NoReturn, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Indirect Shader Invocation void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -1648,8 +1648,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, false, false, true, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReportHit, "ReportHit", OCC::ReportHit, @@ -1657,8 +1657,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, false, false, true, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::CallShader, "CallShader", OCC::CallShader, @@ -1666,8 +1666,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, false, false, true, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Library create handle from resource struct (like HL intrinsic) void, h, // f, d, i1, i8, i16, i32, i64, udt, obj, vec, @@ -1679,8 +1679,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, false, false, false, true, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Raytracing object space uint System Values void, h, f, d, i1, // i8, i16, i32, i64, udt, obj, vec, function attribute, ext @@ -1692,8 +1692,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Dot product with accumulate void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -1705,8 +1705,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Dot4AddI8Packed, "Dot4AddI8Packed", OCC::Dot4AddPacked, @@ -1714,8 +1714,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Dot4AddU8Packed, "Dot4AddU8Packed", OCC::Dot4AddPacked, @@ -1723,8 +1723,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Wave void, h, f, d, i1, i8, i16, i32, i64, udt, // obj, vec, function attribute, ext oload, vec oload @@ -1735,8 +1735,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, true, true, true, true, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::WaveMultiPrefixOp, "WaveMultiPrefixOp", OCC::WaveMultiPrefixOp, @@ -1744,8 +1744,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, true, true, true, true, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::WaveMultiPrefixBitCount, "WaveMultiPrefixBitCount", OCC::WaveMultiPrefixBitCount, @@ -1753,8 +1753,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Mesh shader instructions void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -1766,8 +1766,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::EmitIndices, "EmitIndices", OCC::EmitIndices, @@ -1775,8 +1775,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::GetMeshPayload, "GetMeshPayload", OCC::GetMeshPayload, @@ -1784,8 +1784,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, false, false, true, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::StoreVertexOutput, "StoreVertexOutput", OCC::StoreVertexOutput, @@ -1793,8 +1793,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::StorePrimitiveOutput, "StorePrimitiveOutput", OCC::StorePrimitiveOutput, @@ -1802,8 +1802,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Amplification shader instructions void, h, f, d, i1, i8, // i16, i32, i64, udt, obj, vec, function attribute, ext oload, @@ -1815,8 +1815,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, false, false, true, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Sampler Feedback void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -1827,8 +1827,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::WriteSamplerFeedbackBias, "WriteSamplerFeedbackBias", OCC::WriteSamplerFeedbackBias, @@ -1836,8 +1836,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::WriteSamplerFeedbackLevel, "WriteSamplerFeedbackLevel", OCC::WriteSamplerFeedbackLevel, @@ -1845,8 +1845,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::WriteSamplerFeedbackGrad, "WriteSamplerFeedbackGrad", OCC::WriteSamplerFeedbackGrad, @@ -1854,8 +1854,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Inline Ray Query void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -1866,8 +1866,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_TraceRayInline, "RayQuery_TraceRayInline", OCC::RayQuery_TraceRayInline, @@ -1875,8 +1875,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_Proceed, "RayQuery_Proceed", OCC::RayQuery_Proceed, @@ -1884,8 +1884,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, true, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_Abort, "RayQuery_Abort", OCC::RayQuery_Abort, @@ -1893,8 +1893,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CommitNonOpaqueTriangleHit, "RayQuery_CommitNonOpaqueTriangleHit", OCC::RayQuery_CommitNonOpaqueTriangleHit, @@ -1902,8 +1902,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CommitProceduralPrimitiveHit, "RayQuery_CommitProceduralPrimitiveHit", OCC::RayQuery_CommitProceduralPrimitiveHit, @@ -1911,8 +1911,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CommittedStatus, "RayQuery_CommittedStatus", OCC::RayQuery_StateScalar, @@ -1920,8 +1920,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CandidateType, "RayQuery_CandidateType", OCC::RayQuery_StateScalar, @@ -1929,8 +1929,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CandidateObjectToWorld3x4, "RayQuery_CandidateObjectToWorld3x4", OCC::RayQuery_StateMatrix, @@ -1938,8 +1938,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CandidateWorldToObject3x4, "RayQuery_CandidateWorldToObject3x4", OCC::RayQuery_StateMatrix, @@ -1947,8 +1947,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CommittedObjectToWorld3x4, "RayQuery_CommittedObjectToWorld3x4", OCC::RayQuery_StateMatrix, @@ -1956,8 +1956,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CommittedWorldToObject3x4, "RayQuery_CommittedWorldToObject3x4", OCC::RayQuery_StateMatrix, @@ -1965,8 +1965,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CandidateProceduralPrimitiveNonOpaque, "RayQuery_CandidateProceduralPrimitiveNonOpaque", OCC::RayQuery_StateScalar, @@ -1974,8 +1974,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, true, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CandidateTriangleFrontFace, "RayQuery_CandidateTriangleFrontFace", OCC::RayQuery_StateScalar, @@ -1983,8 +1983,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, true, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CommittedTriangleFrontFace, "RayQuery_CommittedTriangleFrontFace", OCC::RayQuery_StateScalar, @@ -1992,8 +1992,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, true, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CandidateTriangleBarycentrics, "RayQuery_CandidateTriangleBarycentrics", OCC::RayQuery_StateVector, @@ -2001,8 +2001,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CommittedTriangleBarycentrics, "RayQuery_CommittedTriangleBarycentrics", OCC::RayQuery_StateVector, @@ -2010,8 +2010,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_RayFlags, "RayQuery_RayFlags", OCC::RayQuery_StateScalar, @@ -2019,8 +2019,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_WorldRayOrigin, "RayQuery_WorldRayOrigin", OCC::RayQuery_StateVector, @@ -2028,8 +2028,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_WorldRayDirection, "RayQuery_WorldRayDirection", OCC::RayQuery_StateVector, @@ -2037,8 +2037,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_RayTMin, "RayQuery_RayTMin", OCC::RayQuery_StateScalar, @@ -2046,8 +2046,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CandidateTriangleRayT, "RayQuery_CandidateTriangleRayT", OCC::RayQuery_StateScalar, @@ -2055,8 +2055,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CommittedRayT, "RayQuery_CommittedRayT", OCC::RayQuery_StateScalar, @@ -2064,8 +2064,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CandidateInstanceIndex, "RayQuery_CandidateInstanceIndex", OCC::RayQuery_StateScalar, @@ -2073,8 +2073,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CandidateInstanceID, "RayQuery_CandidateInstanceID", OCC::RayQuery_StateScalar, @@ -2082,8 +2082,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CandidateGeometryIndex, "RayQuery_CandidateGeometryIndex", OCC::RayQuery_StateScalar, @@ -2091,8 +2091,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CandidatePrimitiveIndex, "RayQuery_CandidatePrimitiveIndex", OCC::RayQuery_StateScalar, @@ -2100,8 +2100,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CandidateObjectRayOrigin, "RayQuery_CandidateObjectRayOrigin", OCC::RayQuery_StateVector, @@ -2109,8 +2109,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CandidateObjectRayDirection, "RayQuery_CandidateObjectRayDirection", OCC::RayQuery_StateVector, @@ -2118,8 +2118,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CommittedInstanceIndex, "RayQuery_CommittedInstanceIndex", OCC::RayQuery_StateScalar, @@ -2127,8 +2127,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CommittedInstanceID, "RayQuery_CommittedInstanceID", OCC::RayQuery_StateScalar, @@ -2136,8 +2136,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CommittedGeometryIndex, "RayQuery_CommittedGeometryIndex", OCC::RayQuery_StateScalar, @@ -2145,8 +2145,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CommittedPrimitiveIndex, "RayQuery_CommittedPrimitiveIndex", OCC::RayQuery_StateScalar, @@ -2154,8 +2154,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CommittedObjectRayOrigin, "RayQuery_CommittedObjectRayOrigin", OCC::RayQuery_StateVector, @@ -2163,8 +2163,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CommittedObjectRayDirection, "RayQuery_CommittedObjectRayDirection", OCC::RayQuery_StateVector, @@ -2172,8 +2172,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Raytracing object space uint System Values, raytracing tier 1.1 void, h, // f, d, i1, i8, i16, i32, i64, udt, obj, vec, @@ -2185,8 +2185,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Inline Ray Query void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -2197,8 +2197,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RayQuery_CommittedInstanceContributionToHitGroupIndex, "RayQuery_CommittedInstanceContributionToHitGroupIndex", OCC::RayQuery_StateScalar, @@ -2206,8 +2206,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Get handle from heap void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -2218,8 +2218,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::CreateHandleFromBinding, "CreateHandleFromBinding", OCC::CreateHandleFromBinding, @@ -2227,8 +2227,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::CreateHandleFromHeap, "CreateHandleFromHeap", OCC::CreateHandleFromHeap, @@ -2236,8 +2236,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Unpacking intrinsics void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -2248,8 +2248,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Packing intrinsics void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -2260,8 +2260,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Helper Lanes void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -2272,8 +2272,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, true, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Quad Wave Ops void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -2284,8 +2284,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, true, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Resources - gather void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -2296,8 +2296,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, true, true, true, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Resources - sample void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -2308,8 +2308,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Resources void, h, f, d, i1, i8, i16, i32, i64, // udt, obj, vec, function attribute, ext oload, vec oload @@ -2320,8 +2320,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, true, true, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // void, h, f, d, i1, i8, i16, i32, i64, udt, obj, vec, function attribute, ext oload, vec oload {OC::Reserved0, @@ -2331,8 +2331,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Reserved1, "Reserved1", OCC::Reserved, @@ -2340,8 +2340,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Reserved2, "Reserved2", OCC::Reserved, @@ -2349,8 +2349,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Reserved3, "Reserved3", OCC::Reserved, @@ -2358,8 +2358,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Reserved4, "Reserved4", OCC::Reserved, @@ -2367,8 +2367,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Reserved5, "Reserved5", OCC::Reserved, @@ -2376,8 +2376,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Reserved6, "Reserved6", OCC::Reserved, @@ -2385,8 +2385,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Reserved7, "Reserved7", OCC::Reserved, @@ -2394,8 +2394,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Reserved8, "Reserved8", OCC::Reserved, @@ -2403,8 +2403,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Reserved9, "Reserved9", OCC::Reserved, @@ -2412,8 +2412,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Reserved10, "Reserved10", OCC::Reserved, @@ -2421,8 +2421,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::Reserved11, "Reserved11", OCC::Reserved, @@ -2430,8 +2430,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Create/Annotate Node Handles void, h, f, d, i1, i8, // i16, i32, i64, udt, obj, vec, function attribute, ext oload, @@ -2443,8 +2443,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Get Pointer to Node Record in Address Space 6 void, h, f, d, // i1, i8, i16, i32, i64, udt, obj, vec, function attribute, @@ -2456,8 +2456,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, false, false, true, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Work Graph intrinsics void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -2469,8 +2469,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::OutputComplete, "OutputComplete", OCC::OutputComplete, @@ -2478,8 +2478,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::GetInputRecordCount, "GetInputRecordCount", OCC::GetInputRecordCount, @@ -2487,8 +2487,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::FinishedCrossGroupSharing, "FinishedCrossGroupSharing", OCC::FinishedCrossGroupSharing, @@ -2496,8 +2496,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Synchronization void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -2508,8 +2508,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::NoDuplicate, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::BarrierByMemoryHandle, "BarrierByMemoryHandle", OCC::BarrierByMemoryHandle, @@ -2517,8 +2517,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::NoDuplicate, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::BarrierByNodeRecordHandle, "BarrierByNodeRecordHandle", OCC::BarrierByNodeRecordHandle, @@ -2526,8 +2526,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::NoDuplicate, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Create/Annotate Node Handles void, h, f, d, i1, i8, // i16, i32, i64, udt, obj, vec, function attribute, ext oload, @@ -2539,8 +2539,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::IndexNodeHandle, "IndexNodeHandle", OCC::IndexNodeHandle, @@ -2548,8 +2548,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::AnnotateNodeHandle, "AnnotateNodeHandle", OCC::AnnotateNodeHandle, @@ -2557,8 +2557,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::CreateNodeInputRecordHandle, "CreateNodeInputRecordHandle", OCC::CreateNodeInputRecordHandle, @@ -2566,8 +2566,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::AnnotateNodeRecordHandle, "AnnotateNodeRecordHandle", OCC::AnnotateNodeRecordHandle, @@ -2575,8 +2575,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Work Graph intrinsics void, h, f, d, i1, i8, i16, // i32, i64, udt, obj, vec, function attribute, ext oload, vec @@ -2588,8 +2588,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::GetRemainingRecursionLevels, "GetRemainingRecursionLevels", OCC::GetRemainingRecursionLevels, @@ -2597,8 +2597,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Comparison Samples void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -2609,8 +2609,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::SampleCmpBias, "SampleCmpBias", OCC::SampleCmpBias, @@ -2618,8 +2618,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, false, false, false, false, false, false, false, false, false, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Extended Command Information void, h, f, d, i1, i8, // i16, i32, i64, udt, obj, vec, function attribute, ext oload, @@ -2631,8 +2631,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::StartInstanceLocation, "StartInstanceLocation", OCC::StartInstanceLocation, @@ -2640,8 +2640,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, false, false, false, false, false, false, true, false, false, false, false, false}, Attribute::ReadNone, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // Inline Ray Query void, h, f, d, i1, i8, i16, i32, // i64, udt, obj, vec, function attribute, ext oload, vec oload @@ -2652,8 +2652,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, // void, h, f, d, i1, i8, i16, i32, i64, udt, obj, vec, function attribute, ext oload, vec oload {OC::ReservedA0, @@ -2663,8 +2663,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedA1, "ReservedA1", OCC::Reserved, @@ -2672,8 +2672,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedA2, "ReservedA2", OCC::Reserved, @@ -2681,8 +2681,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB0, "ReservedB0", OCC::Reserved, @@ -2690,8 +2690,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB1, "ReservedB1", OCC::Reserved, @@ -2699,8 +2699,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB2, "ReservedB2", OCC::Reserved, @@ -2708,8 +2708,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB3, "ReservedB3", OCC::Reserved, @@ -2717,8 +2717,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB4, "ReservedB4", OCC::Reserved, @@ -2726,8 +2726,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB5, "ReservedB5", OCC::Reserved, @@ -2735,8 +2735,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB6, "ReservedB6", OCC::Reserved, @@ -2744,8 +2744,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB7, "ReservedB7", OCC::Reserved, @@ -2753,8 +2753,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB8, "ReservedB8", OCC::Reserved, @@ -2762,8 +2762,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB9, "ReservedB9", OCC::Reserved, @@ -2771,8 +2771,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB10, "ReservedB10", OCC::Reserved, @@ -2780,8 +2780,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB11, "ReservedB11", OCC::Reserved, @@ -2789,8 +2789,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB12, "ReservedB12", OCC::Reserved, @@ -2798,8 +2798,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB13, "ReservedB13", OCC::Reserved, @@ -2807,8 +2807,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB14, "ReservedB14", OCC::Reserved, @@ -2816,8 +2816,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB15, "ReservedB15", OCC::Reserved, @@ -2825,8 +2825,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB16, "ReservedB16", OCC::Reserved, @@ -2834,8 +2834,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB17, "ReservedB17", OCC::Reserved, @@ -2843,8 +2843,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB18, "ReservedB18", OCC::Reserved, @@ -2852,8 +2852,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB19, "ReservedB19", OCC::Reserved, @@ -2861,8 +2861,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB20, "ReservedB20", OCC::Reserved, @@ -2870,8 +2870,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB21, "ReservedB21", OCC::Reserved, @@ -2879,8 +2879,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB22, "ReservedB22", OCC::Reserved, @@ -2888,8 +2888,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB23, "ReservedB23", OCC::Reserved, @@ -2897,8 +2897,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB24, "ReservedB24", OCC::Reserved, @@ -2906,8 +2906,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB25, "ReservedB25", OCC::Reserved, @@ -2915,8 +2915,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB26, "ReservedB26", OCC::Reserved, @@ -2924,8 +2924,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB27, "ReservedB27", OCC::Reserved, @@ -2933,8 +2933,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB28, "ReservedB28", OCC::Reserved, @@ -2942,8 +2942,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB29, "ReservedB29", OCC::Reserved, @@ -2951,8 +2951,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedB30, "ReservedB30", OCC::Reserved, @@ -2960,8 +2960,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedC0, "ReservedC0", OCC::Reserved, @@ -2969,8 +2969,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedC1, "ReservedC1", OCC::Reserved, @@ -2978,8 +2978,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedC2, "ReservedC2", OCC::Reserved, @@ -2987,8 +2987,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedC3, "ReservedC3", OCC::Reserved, @@ -2996,8 +2996,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedC4, "ReservedC4", OCC::Reserved, @@ -3005,8 +3005,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedC5, "ReservedC5", OCC::Reserved, @@ -3014,8 +3014,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedC6, "ReservedC6", OCC::Reserved, @@ -3023,8 +3023,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedC7, "ReservedC7", OCC::Reserved, @@ -3032,8 +3032,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedC8, "ReservedC8", OCC::Reserved, @@ -3041,8 +3041,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::ReservedC9, "ReservedC9", OCC::Reserved, @@ -3050,8 +3050,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {true, false, false, false, false, false, false, false, false, false, false, false, false}, Attribute::None, - {0x0, 0x0}, - {0x0, 0x0}}, + {{0x0}, {0x0}}, + {{0x0}, {0x0}}}, {OC::RawBufferVectorLoad, "RawBufferVectorLoad", OCC::RawBufferVectorLoad, @@ -3059,8 +3059,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, false, true, true, true, false, false, true, false}, Attribute::ReadOnly, - {0x0, 0x0}, - {0x1ce, 0x0}}, + {{0x0}, {0x0}}, + {{0x1ce}, {0x0}}}, {OC::RawBufferVectorStore, "RawBufferVectorStore", OCC::RawBufferVectorStore, @@ -3068,8 +3068,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = { {false, true, true, true, false, false, true, true, true, false, false, true, false}, Attribute::None, - {0x0, 0x0}, - {0x1ce, 0x0}}, + {{0x0}, {0x0}}, + {{0x1ce}, {0x0}}}, }; // OPCODE-OLOADS:END From 5674a1848801ac94fe473fe5d1512920ebbc612b Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Tue, 25 Mar 2025 19:55:01 -0700 Subject: [PATCH 45/45] Update extended and vector overload support for DXIL - Apply fixes --- lib/DXIL/DxilOperations.cpp | 2 +- utils/hct/hctdb.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/DXIL/DxilOperations.cpp b/lib/DXIL/DxilOperations.cpp index 29ec115824..02e72fb401 100644 --- a/lib/DXIL/DxilOperations.cpp +++ b/lib/DXIL/DxilOperations.cpp @@ -3253,7 +3253,7 @@ bool OP::IsOverloadLegal(OpCode opCode, Type *pType) { return false; if (OloadSlot == kVectorTypeSlot) { unsigned EltTypeSlot = - GetTypeSlot(cast(pType)->getElementType()); + GetTypeSlot(cast(ElTy)->getElementType()); if (!OpProps.AllowedVectorElements[I][EltTypeSlot]) return false; } diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 5352e4d839..66b897945e 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -232,6 +232,10 @@ def process_oload_types(self): self.vector_oload_types[n] = vector_oloads if len(oload_types) > 1: self.oload_types = "x" + self.extended_oload_types[: len(oload_types)] = oload_types + self.check_extended_oload_ops() + else: + self.oload_types = oload_types[0] def check_extended_oload_ops(self): "Ensure ops has sequential extended overload references with $x0, $x1, etc."