Skip to content

Commit

Permalink
[Validator] AMD_gpu_shader_half_float_fetch allow float16 (KhronosGro…
Browse files Browse the repository at this point in the history
…up#1393)

SPV_AMD_gpu_shader_half_float_fetch extension should implicitly
allow declaring 16bit float.
  • Loading branch information
jaebaek committed Oct 2, 2018
1 parent 37c99ab commit d73b9d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/val/validation_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ void ValidationState_t::RegisterExtension(Extension ext) {

switch (ext) {
case kSPV_AMD_gpu_shader_half_float:
case kSPV_AMD_gpu_shader_half_float_fetch:
// SPV_AMD_gpu_shader_half_float enables float16 type.
// https://github.com/KhronosGroup/SPIRV-Tools/issues/1375
features_.declare_float16_type = true;
Expand Down
11 changes: 11 additions & 0 deletions test/val/val_data_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,17 @@ TEST_F(ValidateData, storage_input_output_16_good) {
ASSERT_EQ(SPV_SUCCESS, ValidateInstructions());
}

TEST_F(ValidateData, amd_gpu_shader_half_float_fetch_16_good) {
std::string str = R"(
OpCapability Shader
OpCapability Linkage
OpExtension "SPV_AMD_gpu_shader_half_float_fetch"
OpMemoryModel Logical GLSL450
%2 = OpTypeFloat 16)";
CompileSuccessfully(str.c_str());
ASSERT_EQ(SPV_SUCCESS, ValidateInstructions());
}

TEST_F(ValidateData, int16_bad) {
std::string str = header + "%2 = OpTypeInt 16 1";
CompileSuccessfully(str.c_str());
Expand Down

0 comments on commit d73b9d8

Please sign in to comment.