16
16
17
17
// Validates correctness of composite SPIR-V instructions.
18
18
19
+ #include < climits>
20
+
19
21
#include " source/opcode.h"
20
22
#include " source/spirv_target_env.h"
21
23
#include " source/val/instruction.h"
@@ -640,7 +642,7 @@ spv_result_t ValidateCompositeConstructCoopMatQCOM(ValidationState_t& _,
640
642
641
643
// Is the scope Subgrouop ?
642
644
{
643
- unsigned scope = - 1u ;
645
+ unsigned scope = UINT_MAX ;
644
646
unsigned scope_id = result_type_inst->GetOperandAs <unsigned >(2u );
645
647
bool status = _.GetConstantValueAs <unsigned >(scope_id, scope);
646
648
bool is_scope_spec_const =
@@ -653,7 +655,7 @@ spv_result_t ValidateCompositeConstructCoopMatQCOM(ValidationState_t& _,
653
655
}
654
656
}
655
657
656
- unsigned ar_len = - 1u ;
658
+ unsigned ar_len = UINT_MAX ;
657
659
unsigned src_arr_len_id = source_type_inst->GetOperandAs <unsigned >(2u );
658
660
bool ar_len_status = _.GetConstantValueAs <unsigned >(src_arr_len_id, ar_len);
659
661
bool is_src_arr_len_spec_const =
@@ -676,7 +678,7 @@ spv_result_t ValidateCompositeConstructCoopMatQCOM(ValidationState_t& _,
676
678
unsigned res_col_id = result_type_inst->GetOperandAs <unsigned >(4u );
677
679
unsigned res_use_id = result_type_inst->GetOperandAs <unsigned >(5u );
678
680
679
- unsigned cm_use = - 1u ;
681
+ unsigned cm_use = UINT_MAX ;
680
682
bool cm_use_status = _.GetConstantValueAs <unsigned >(res_use_id, cm_use);
681
683
682
684
switch (static_cast <spv::CooperativeMatrixUse>(cm_use)) {
@@ -691,7 +693,7 @@ spv_result_t ValidateCompositeConstructCoopMatQCOM(ValidationState_t& _,
691
693
}
692
694
693
695
// result coopmat column length check
694
- unsigned n_cols = - 1u ;
696
+ unsigned n_cols = UINT_MAX ;
695
697
bool status = _.GetConstantValueAs <unsigned >(res_col_id, n_cols);
696
698
bool is_res_col_spec_const =
697
699
spvOpcodeIsSpecConstant (_.FindDef (res_col_id)->opcode ());
@@ -738,7 +740,7 @@ spv_result_t ValidateCompositeConstructCoopMatQCOM(ValidationState_t& _,
738
740
}
739
741
740
742
// result coopmat row length check
741
- unsigned n_rows = - 1u ;
743
+ unsigned n_rows = UINT_MAX ;
742
744
bool status = _.GetConstantValueAs <unsigned >(res_row_id, n_rows);
743
745
bool is_res_row_spec_const =
744
746
spvOpcodeIsSpecConstant (_.FindDef (res_row_id)->opcode ());
@@ -785,7 +787,7 @@ spv_result_t ValidateCompositeConstructCoopMatQCOM(ValidationState_t& _,
785
787
}
786
788
787
789
// source array length check
788
- unsigned n_cols = - 1u ;
790
+ unsigned n_cols = UINT_MAX ;
789
791
bool status = _.GetConstantValueAs <unsigned >(res_col_id, n_cols);
790
792
bool is_res_col_spec_const =
791
793
spvOpcodeIsSpecConstant (_.FindDef (res_col_id)->opcode ());
@@ -848,7 +850,7 @@ spv_result_t ValidateCompositeExtractCoopMatQCOM(ValidationState_t& _,
848
850
849
851
// Is the scope Subgrouop ?
850
852
{
851
- unsigned scope = - 1u ;
853
+ unsigned scope = UINT_MAX ;
852
854
unsigned scope_id = source_type_inst->GetOperandAs <unsigned >(2u );
853
855
bool status = _.GetConstantValueAs <unsigned >(scope_id, scope);
854
856
bool is_scope_spec_const =
@@ -861,7 +863,7 @@ spv_result_t ValidateCompositeExtractCoopMatQCOM(ValidationState_t& _,
861
863
}
862
864
}
863
865
864
- unsigned ar_len = - 1u ;
866
+ unsigned ar_len = UINT_MAX ;
865
867
unsigned res_arr_len_id = result_type_inst->GetOperandAs <unsigned >(2u );
866
868
bool ar_len_status = _.GetConstantValueAs <unsigned >(res_arr_len_id, ar_len);
867
869
bool is_res_arr_len_spec_const =
@@ -874,7 +876,7 @@ spv_result_t ValidateCompositeExtractCoopMatQCOM(ValidationState_t& _,
874
876
unsigned src_col_id = source_type_inst->GetOperandAs <unsigned >(4u );
875
877
unsigned src_use_id = source_type_inst->GetOperandAs <unsigned >(5u );
876
878
877
- unsigned cm_use = - 1u ;
879
+ unsigned cm_use = UINT_MAX ;
878
880
bool cm_use_status = _.GetConstantValueAs <unsigned >(src_use_id, cm_use);
879
881
880
882
switch (static_cast <spv::CooperativeMatrixUse>(cm_use)) {
@@ -889,7 +891,7 @@ spv_result_t ValidateCompositeExtractCoopMatQCOM(ValidationState_t& _,
889
891
}
890
892
891
893
// source coopmat column length check
892
- unsigned n_cols = - 1u ;
894
+ unsigned n_cols = UINT_MAX ;
893
895
bool status = _.GetConstantValueAs <unsigned >(src_col_id, n_cols);
894
896
bool is_src_col_spec_const =
895
897
spvOpcodeIsSpecConstant (_.FindDef (src_col_id)->opcode ());
@@ -937,7 +939,7 @@ spv_result_t ValidateCompositeExtractCoopMatQCOM(ValidationState_t& _,
937
939
}
938
940
939
941
// source coopmat row length check
940
- unsigned n_rows = - 1u ;
942
+ unsigned n_rows = UINT_MAX ;
941
943
bool status = _.GetConstantValueAs <unsigned >(src_row_id, n_rows);
942
944
bool is_src_row_spec_const =
943
945
spvOpcodeIsSpecConstant (_.FindDef (src_row_id)->opcode ());
@@ -985,7 +987,7 @@ spv_result_t ValidateCompositeExtractCoopMatQCOM(ValidationState_t& _,
985
987
}
986
988
987
989
// result type check
988
- unsigned n_cols = - 1u ;
990
+ unsigned n_cols = UINT_MAX ;
989
991
bool status = _.GetConstantValueAs <unsigned >(src_col_id, n_cols);
990
992
bool is_src_col_spec_const =
991
993
spvOpcodeIsSpecConstant (_.FindDef (src_col_id)->opcode ());
0 commit comments