Skip to content

Commit f36758f

Browse files
Fix build errors
1 parent 64a01e9 commit f36758f

3 files changed

Lines changed: 36 additions & 4 deletions

File tree

tools/clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8034,6 +8034,8 @@ def err_hlsl_linalg_matrix_dim_must_not_be_zero: Error<
80348034
"matrix dimension must not be zero">;
80358035
def err_hlsl_linalg_matrix_layout_invalid : Error<
80368036
"matrix layout %0 is not valid, must be in the range %1 - %2">;
8037+
def err_hlsl_linalg_function_requires_shader_model_6_9_or_above : Error<
8038+
"intrinsic function %0 requires shader model 6.9 or greater">;
80378039

80388040
def err_hlsl_linalg_mul_muladd_output_vector_size_not_equal_to_matrix_M : Error<
80398041
"output vector length must be equal to Matrix M dimension in a linalg Mul/MulAdd operation">;

tools/clang/lib/Sema/SemaHLSL.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12267,14 +12267,44 @@ void Sema::CheckHLSLFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall,
1226712267
CheckBarrierCall(*this, FDecl, TheCall, SM);
1226812268
break;
1226912269
case hlsl::IntrinsicOp::IOP___builtin_MatVecMul:
12270+
if (!SM->IsSM69Plus()) {
12271+
Diags.Report(
12272+
TheCall->getExprLoc(),
12273+
diag::err_hlsl_linalg_function_requires_shader_model_6_9_or_above)
12274+
<< FDecl->getNameAsString();
12275+
return;
12276+
}
1227012277
CheckMulCall(*this, FDecl, TheCall, SM);
1227112278
break;
1227212279
case hlsl::IntrinsicOp::IOP___builtin_MatVecMulAdd:
12280+
if (!SM->IsSM69Plus()) {
12281+
Diags.Report(
12282+
TheCall->getExprLoc(),
12283+
diag::err_hlsl_linalg_function_requires_shader_model_6_9_or_above)
12284+
<< FDecl->getNameAsString();
12285+
return;
12286+
}
1227312287
CheckMulAddCall(*this, FDecl, TheCall, SM);
1227412288
break;
1227512289
case hlsl::IntrinsicOp::IOP___builtin_OuterProductAccumulate:
12290+
if (!SM->IsSM69Plus()) {
12291+
Diags.Report(
12292+
TheCall->getExprLoc(),
12293+
diag::err_hlsl_linalg_function_requires_shader_model_6_9_or_above)
12294+
<< FDecl->getNameAsString();
12295+
return;
12296+
}
1227612297
CheckOuterProductAccumulateCall(*this, FDecl, TheCall);
1227712298
break;
12299+
case hlsl::IntrinsicOp::IOP___builtin_VectorAccumulate:
12300+
if (!SM->IsSM69Plus()) {
12301+
Diags.Report(
12302+
TheCall->getExprLoc(),
12303+
diag::err_hlsl_linalg_function_requires_shader_model_6_9_or_above)
12304+
<< FDecl->getNameAsString();
12305+
return;
12306+
}
12307+
break;
1227812308
#ifdef ENABLE_SPIRV_CODEGEN
1227912309
case hlsl::IntrinsicOp::IOP_Vkreinterpret_pointer_cast:
1228012310
CheckVKBufferPointerCast(*this, FDecl, TheCall, false);

tools/clang/test/SemaHLSL/hlsl/linalg/unavailable-pre-sm69.hlsl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void cs_main()
2323
const bool matrix_is_transposed = false;
2424
const uint matrix_stride = 64;
2525

26-
//expected-error@+1{{intrinsic __builtin_MatVecMul potentially used by 'cs_main' requires shader model 6.9 or greater}}
26+
//expected-error@+1{{intrinsic function __builtin_MatVecMul requires shader model 6.9 or greater}}
2727
__builtin_MatVecMul(output_vector, is_output_unsigned, input_vector,
2828
is_input_unsigned, input_interpretation, matrix_buffer, matrix_offset,
2929
matrix_interpretation, matrix_dimM, matrix_dimK, matrix_layout,
@@ -32,7 +32,7 @@ void cs_main()
3232
const uint bias_offset = 0;
3333
const uint bias_interpretation = 9; /*F32*/
3434

35-
//expected-error@+1{{intrinsic __builtin_MatVecMulAdd potentially used by 'cs_main' requires shader model 6.9 or greater}}
35+
//expected-error@+1{{intrinsic function __builtin_MatVecMulAdd requires shader model 6.9 or greater}}
3636
__builtin_MatVecMulAdd(output_vector, is_output_unsigned, input_vector,
3737
is_input_unsigned, input_interpretation, matrix_buffer, matrix_offset,
3838
matrix_interpretation, matrix_dimM, matrix_dimK, matrix_layout,
@@ -46,14 +46,14 @@ void cs_main()
4646
const uint opa_matrix_layout = 3; /*OuterProductOptimal*/
4747
const uint opa_matrix_stride = 64;
4848

49-
//expected-error@+1{{intrinsic __builtin_OuterProductAccumulate potentially used by 'cs_main' requires shader model 6.9 or greater}}
49+
//expected-error@+1{{intrinsic function __builtin_OuterProductAccumulate requires shader model 6.9 or greater}}
5050
__builtin_OuterProductAccumulate(input_vector1, input_vector2,
5151
rw_matrix_buffer, opa_matrix_offset, opa_matrix_interpretation,
5252
opa_matrix_layout, opa_matrix_stride);
5353

5454
const uint va_matrix_offset = 0;
5555

56-
//expected-error@+1{{intrinsic __builtin_VectorAccumulate potentially used by 'cs_main' requires shader model 6.9 or greater}}
56+
//expected-error@+1{{intrinsic function __builtin_VectorAccumulate requires shader model 6.9 or greater}}
5757
__builtin_VectorAccumulate(input_vector1, rw_matrix_buffer,
5858
va_matrix_offset);
5959
}

0 commit comments

Comments
 (0)