tint: Add end-to-end tests for expressions using f16 types

This patch add DXC compile flag "-enable-16bit-types" and change profile
to SM6.2 when validating generated HLSL using DXC if f16 extension is
enabled in the WGSL program.
The patch add Tint end-to-end test cases for expressions using f16 type,
including constructor, binary operator, splat, zero-init, and others.
Testcases that use f16 types in uniform or storage buffer are SKIPped,
because such usage is not implemented yet.

Bug: tint:1473, tint:1502
Change-Id: I481ab3d12cbb822f11ef85ba807bca3f9770089b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96252
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
This commit is contained in:
Zhaoming Jiang 2022-08-03 08:45:25 +00:00 committed by Dawn LUCI CQ
parent 7d04cedce3
commit 7d7976d590
1039 changed files with 14821 additions and 8 deletions

View File

@ -32,6 +32,7 @@
#include "spirv-tools/libspirv.hpp"
#endif // TINT_BUILD_SPV_READER
#include "src/tint/ast/module.h"
#include "src/tint/utils/io/command.h"
#include "src/tint/utils/string.h"
#include "src/tint/utils/transform.h"
@ -820,7 +821,18 @@ bool GenerateHlsl(const tint::Program* program, const Options& options) {
tint::utils::Command::LookPath(options.dxc_path.empty() ? "dxc" : options.dxc_path);
if (dxc.Found()) {
dxc_found = true;
dxc_res = tint::val::HlslUsingDXC(dxc.Path(), result.hlsl, result.entry_points);
auto enable_list = program->AST().Enables();
bool dxc_require_16bit_types = false;
for (auto enable : enable_list) {
if (enable->extension == tint::ast::Extension::kF16) {
dxc_require_16bit_types = true;
break;
}
}
dxc_res = tint::val::HlslUsingDXC(dxc.Path(), result.hlsl, result.entry_points,
dxc_require_16bit_types);
} else if (must_validate_dxc) {
// DXC was explicitly requested. Error if it could not be found.
dxc_res.failed = true;

View File

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include <string>
#include "src/tint/val/val.h"
#include "src/tint/utils/io/command.h"
@ -31,7 +33,8 @@ namespace tint::val {
Result HlslUsingDXC(const std::string& dxc_path,
const std::string& source,
const EntryPointList& entry_points) {
const EntryPointList& entry_points,
bool require_16bit_types) {
Result result;
auto dxc = utils::Command(dxc_path);
@ -41,11 +44,14 @@ Result HlslUsingDXC(const std::string& dxc_path,
return result;
}
// Native 16-bit types, e.g. float16_t, require SM6.2. Otherwise we use SM6.0.
const char* shader_model_version = require_16bit_types ? "6_2" : "6_0";
utils::TmpFile file;
file << source;
for (auto ep : entry_points) {
const char* profile = "";
const char* stage_prefix = "";
switch (ep.second) {
case ast::PipelineStage::kNone:
@ -53,20 +59,27 @@ Result HlslUsingDXC(const std::string& dxc_path,
result.failed = true;
return result;
case ast::PipelineStage::kVertex:
profile = "-T vs_6_0";
stage_prefix = "vs";
break;
case ast::PipelineStage::kFragment:
profile = "-T ps_6_0";
stage_prefix = "ps";
break;
case ast::PipelineStage::kCompute:
profile = "-T cs_6_0";
stage_prefix = "cs";
break;
}
std::string profile =
"-T " + std::string(stage_prefix) + "_" + std::string(shader_model_version);
if (require_16bit_types) {
// Add "-enable-16bit-types" flag if required
profile = profile + " -enable-16bit-types";
}
// Match Dawn's compile flags
// See dawn\src\dawn_native\d3d12\RenderPipelineD3D12.cpp
// and dawn_native\d3d12\ShaderModuleD3D12.cpp (GetDXCArguments)
auto res = dxc(profile,
auto res = dxc(profile.c_str(),
"-E " + ep.first, // Entry point
"/Zpr", // D3DCOMPILE_PACK_MATRIX_ROW_MAJOR
"/Gis", // D3DCOMPILE_IEEE_STRICTNESS

View File

@ -49,7 +49,8 @@ struct Result {
/// @return the result of the compile
Result HlslUsingDXC(const std::string& dxc_path,
const std::string& source,
const EntryPointList& entry_points);
const EntryPointList& entry_points,
bool require_16bit_types);
#ifdef _WIN32
/// Hlsl attempts to compile the shader with FXC, verifying that the shader

View File

@ -0,0 +1,7 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = mat3x3<f16>(vec3<f16>( 1.h, 2.h, 3.h), vec3<f16>( 4.h, 5.h, 6.h), vec3<f16>( 7.h, 8.h, 9.h));
let b = mat3x3<f16>(vec3<f16>(-1.h, -2.h, -3.h), vec3<f16>(-4.h, -5.h, -6.h), vec3<f16>(-7.h, -8.h, -9.h));
let r : mat3x3<f16> = a + b;
}

View File

@ -0,0 +1,7 @@
[numthreads(1, 1, 1)]
void f() {
const matrix<float16_t, 3, 3> a = matrix<float16_t, 3, 3>(vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 3>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)), vector<float16_t, 3>(float16_t(7.0h), float16_t(8.0h), float16_t(9.0h)));
const matrix<float16_t, 3, 3> b = matrix<float16_t, 3, 3>(vector<float16_t, 3>(float16_t(-1.0h), float16_t(-2.0h), float16_t(-3.0h)), vector<float16_t, 3>(float16_t(-4.0h), float16_t(-5.0h), float16_t(-6.0h)), vector<float16_t, 3>(float16_t(-7.0h), float16_t(-8.0h), float16_t(-9.0h)));
const matrix<float16_t, 3, 3> r = (a + b);
return;
}

View File

@ -0,0 +1,14 @@
SKIP: FAILED
[numthreads(1, 1, 1)]
void f() {
const matrix<float16_t, 3, 3> a = matrix<float16_t, 3, 3>(vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector<float16_t, 3>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)), vector<float16_t, 3>(float16_t(7.0h), float16_t(8.0h), float16_t(9.0h)));
const matrix<float16_t, 3, 3> b = matrix<float16_t, 3, 3>(vector<float16_t, 3>(float16_t(-1.0h), float16_t(-2.0h), float16_t(-3.0h)), vector<float16_t, 3>(float16_t(-4.0h), float16_t(-5.0h), float16_t(-6.0h)), vector<float16_t, 3>(float16_t(-7.0h), float16_t(-8.0h), float16_t(-9.0h)));
const matrix<float16_t, 3, 3> r = (a + b);
return;
}
FXC validation failure:
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002112F6749E0(3,16-24): error X3000: syntax error: unexpected token 'float16_t'
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002112F6749E0(4,16-24): error X3000: syntax error: unexpected token 'float16_t'
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002112F6749E0(5,16-24): error X3000: syntax error: unexpected token 'float16_t'

View File

@ -0,0 +1,14 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
void f() {
f16mat3 a = f16mat3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(4.0hf, 5.0hf, 6.0hf), f16vec3(7.0hf, 8.0hf, 9.0hf));
f16mat3 b = f16mat3(f16vec3(-1.0hf, -2.0hf, -3.0hf), f16vec3(-4.0hf, -5.0hf, -6.0hf), f16vec3(-7.0hf, -8.0hf, -9.0hf));
f16mat3 r = (a + b);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
half3x3 const a = half3x3(half3(1.0h, 2.0h, 3.0h), half3(4.0h, 5.0h, 6.0h), half3(7.0h, 8.0h, 9.0h));
half3x3 const b = half3x3(half3(-1.0h, -2.0h, -3.0h), half3(-4.0h, -5.0h, -6.0h), half3(-7.0h, -8.0h, -9.0h));
half3x3 const r = (a + b);
return;
}

View File

@ -0,0 +1,59 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 45
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%mat3v3half = OpTypeMatrix %v3half 3
%half_0x1p_0 = OpConstant %half 0x1p+0
%half_0x1p_1 = OpConstant %half 0x1p+1
%half_0x1_8p_1 = OpConstant %half 0x1.8p+1
%11 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1
%half_0x1p_2 = OpConstant %half 0x1p+2
%half_0x1_4p_2 = OpConstant %half 0x1.4p+2
%half_0x1_8p_2 = OpConstant %half 0x1.8p+2
%15 = OpConstantComposite %v3half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2
%half_0x1_cp_2 = OpConstant %half 0x1.cp+2
%half_0x1p_3 = OpConstant %half 0x1p+3
%half_0x1_2p_3 = OpConstant %half 0x1.2p+3
%19 = OpConstantComposite %v3half %half_0x1_cp_2 %half_0x1p_3 %half_0x1_2p_3
%20 = OpConstantComposite %mat3v3half %11 %15 %19
%half_n0x1p_0 = OpConstant %half -0x1p+0
%half_n0x1p_1 = OpConstant %half -0x1p+1
%half_n0x1_8p_1 = OpConstant %half -0x1.8p+1
%24 = OpConstantComposite %v3half %half_n0x1p_0 %half_n0x1p_1 %half_n0x1_8p_1
%half_n0x1p_2 = OpConstant %half -0x1p+2
%half_n0x1_4p_2 = OpConstant %half -0x1.4p+2
%half_n0x1_8p_2 = OpConstant %half -0x1.8p+2
%28 = OpConstantComposite %v3half %half_n0x1p_2 %half_n0x1_4p_2 %half_n0x1_8p_2
%half_n0x1_cp_2 = OpConstant %half -0x1.cp+2
%half_n0x1p_3 = OpConstant %half -0x1p+3
%half_n0x1_2p_3 = OpConstant %half -0x1.2p+3
%32 = OpConstantComposite %v3half %half_n0x1_cp_2 %half_n0x1p_3 %half_n0x1_2p_3
%33 = OpConstantComposite %mat3v3half %24 %28 %32
%f = OpFunction %void None %1
%4 = OpLabel
%35 = OpCompositeExtract %v3half %20 0
%36 = OpCompositeExtract %v3half %33 0
%37 = OpFAdd %v3half %35 %36
%38 = OpCompositeExtract %v3half %20 1
%39 = OpCompositeExtract %v3half %33 1
%40 = OpFAdd %v3half %38 %39
%41 = OpCompositeExtract %v3half %20 2
%42 = OpCompositeExtract %v3half %33 2
%43 = OpFAdd %v3half %41 %42
%44 = OpCompositeConstruct %mat3v3half %37 %40 %43
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,8 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = mat3x3<f16>(vec3<f16>(1.0h, 2.0h, 3.0h), vec3<f16>(4.0h, 5.0h, 6.0h), vec3<f16>(7.0h, 8.0h, 9.0h));
let b = mat3x3<f16>(vec3<f16>(-1.0h, -2.0h, -3.0h), vec3<f16>(-4.0h, -5.0h, -6.0h), vec3<f16>(-7.0h, -8.0h, -9.0h));
let r : mat3x3<f16> = (a + b);
}

View File

@ -0,0 +1,7 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = 1.h;
let b = 2.h;
let r : f16 = a + b;
}

View File

@ -0,0 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const float16_t r = (float16_t(1.0h) + float16_t(2.0h));
return;
}

View File

@ -0,0 +1,10 @@
SKIP: FAILED
[numthreads(1, 1, 1)]
void f() {
const float16_t r = (float16_t(1.0h) + float16_t(2.0h));
return;
}
FXC validation failure:
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000026EC74E4450(3,9-17): error X3000: unrecognized identifier 'float16_t'

View File

@ -0,0 +1,12 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
void f() {
float16_t r = (1.0hf + 2.0hf);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
half const a = 1.0h;
half const b = 2.0h;
half const r = (a + b);
return;
}

View File

@ -0,0 +1,24 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 9
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%half = OpTypeFloat 16
%half_0x1p_0 = OpConstant %half 0x1p+0
%half_0x1p_1 = OpConstant %half 0x1p+1
%f = OpFunction %void None %1
%4 = OpLabel
%8 = OpFAdd %half %half_0x1p_0 %half_0x1p_1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,8 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = 1.0h;
let b = 2.0h;
let r : f16 = (a + b);
}

View File

@ -0,0 +1,7 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = 4.h;
let b = vec3<f16>(1.h, 2.h, 3.h);
let r : vec3<f16> = a + b;
}

View File

@ -0,0 +1,7 @@
[numthreads(1, 1, 1)]
void f() {
const float16_t a = float16_t(4.0h);
const vector<float16_t, 3> b = vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h));
const vector<float16_t, 3> r = (a + b);
return;
}

View File

@ -0,0 +1,12 @@
SKIP: FAILED
[numthreads(1, 1, 1)]
void f() {
const float16_t a = float16_t(4.0h);
const vector<float16_t, 3> b = vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h));
const vector<float16_t, 3> r = (a + b);
return;
}
FXC validation failure:
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001CF2FA94E40(3,9-17): error X3000: unrecognized identifier 'float16_t'

View File

@ -0,0 +1,14 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
void f() {
float16_t a = 4.0hf;
f16vec3 b = f16vec3(1.0hf, 2.0hf, 3.0hf);
f16vec3 r = (a + b);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
half const a = 4.0h;
half3 const b = half3(1.0h, 2.0h, 3.0h);
half3 const r = (a + b);
return;
}

View File

@ -0,0 +1,32 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 17
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%half = OpTypeFloat 16
%half_0x1p_2 = OpConstant %half 0x1p+2
%v3half = OpTypeVector %half 3
%half_0x1p_0 = OpConstant %half 0x1p+0
%half_0x1p_1 = OpConstant %half 0x1p+1
%half_0x1_8p_1 = OpConstant %half 0x1.8p+1
%11 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1
%_ptr_Function_v3half = OpTypePointer Function %v3half
%15 = OpConstantNull %v3half
%f = OpFunction %void None %1
%4 = OpLabel
%13 = OpVariable %_ptr_Function_v3half Function %15
%16 = OpCompositeConstruct %v3half %half_0x1p_2 %half_0x1p_2 %half_0x1p_2
%12 = OpFAdd %v3half %16 %11
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,8 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = 4.0h;
let b = vec3<f16>(1.0h, 2.0h, 3.0h);
let r : vec3<f16> = (a + b);
}

View File

@ -0,0 +1,7 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = vec3<f16>(1.h, 2.h, 3.h);
let b = 4.h;
let r : vec3<f16> = a + b;
}

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void f() {
const vector<float16_t, 3> a = vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h));
const vector<float16_t, 3> r = (a + float16_t(4.0h));
return;
}

View File

@ -0,0 +1,12 @@
SKIP: FAILED
[numthreads(1, 1, 1)]
void f() {
const vector<float16_t, 3> a = vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h));
const vector<float16_t, 3> r = (a + float16_t(4.0h));
return;
}
FXC validation failure:
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000023450E536E0(3,16-24): error X3000: syntax error: unexpected token 'float16_t'
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000023450E536E0(4,16-24): error X3000: syntax error: unexpected token 'float16_t'

View File

@ -0,0 +1,13 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
void f() {
f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf);
f16vec3 r = (a + 4.0hf);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
half3 const a = half3(1.0h, 2.0h, 3.0h);
half const b = 4.0h;
half3 const r = (a + b);
return;
}

View File

@ -0,0 +1,32 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 17
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%half_0x1p_0 = OpConstant %half 0x1p+0
%half_0x1p_1 = OpConstant %half 0x1p+1
%half_0x1_8p_1 = OpConstant %half 0x1.8p+1
%10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1
%half_0x1p_2 = OpConstant %half 0x1p+2
%_ptr_Function_v3half = OpTypePointer Function %v3half
%15 = OpConstantNull %v3half
%f = OpFunction %void None %1
%4 = OpLabel
%13 = OpVariable %_ptr_Function_v3half Function %15
%16 = OpCompositeConstruct %v3half %half_0x1p_2 %half_0x1p_2 %half_0x1p_2
%12 = OpFAdd %v3half %10 %16
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,8 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = vec3<f16>(1.0h, 2.0h, 3.0h);
let b = 4.0h;
let r : vec3<f16> = (a + b);
}

View File

@ -0,0 +1,7 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = vec3<f16>(1.h, 2.h, 3.h);
let b = vec3<f16>(4.h, 5.h, 6.h);
let r : vec3<f16> = a + b;
}

View File

@ -0,0 +1,7 @@
[numthreads(1, 1, 1)]
void f() {
const vector<float16_t, 3> a = vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h));
const vector<float16_t, 3> b = vector<float16_t, 3>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h));
const vector<float16_t, 3> r = (a + b);
return;
}

View File

@ -0,0 +1,14 @@
SKIP: FAILED
[numthreads(1, 1, 1)]
void f() {
const vector<float16_t, 3> a = vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h));
const vector<float16_t, 3> b = vector<float16_t, 3>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h));
const vector<float16_t, 3> r = (a + b);
return;
}
FXC validation failure:
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001C79E5B27F0(3,16-24): error X3000: syntax error: unexpected token 'float16_t'
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001C79E5B27F0(4,16-24): error X3000: syntax error: unexpected token 'float16_t'
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001C79E5B27F0(5,16-24): error X3000: syntax error: unexpected token 'float16_t'

View File

@ -0,0 +1,14 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
void f() {
f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf);
f16vec3 b = f16vec3(4.0hf, 5.0hf, 6.0hf);
f16vec3 r = (a + b);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
half3 const a = half3(1.0h, 2.0h, 3.0h);
half3 const b = half3(4.0h, 5.0h, 6.0h);
half3 const r = (a + b);
return;
}

View File

@ -0,0 +1,31 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 16
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%half_0x1p_0 = OpConstant %half 0x1p+0
%half_0x1p_1 = OpConstant %half 0x1p+1
%half_0x1_8p_1 = OpConstant %half 0x1.8p+1
%10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1
%half_0x1p_2 = OpConstant %half 0x1p+2
%half_0x1_4p_2 = OpConstant %half 0x1.4p+2
%half_0x1_8p_2 = OpConstant %half 0x1.8p+2
%14 = OpConstantComposite %v3half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2
%f = OpFunction %void None %1
%4 = OpLabel
%15 = OpFAdd %v3half %10 %14
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,8 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = vec3<f16>(1.0h, 2.0h, 3.0h);
let b = vec3<f16>(4.0h, 5.0h, 6.0h);
let r : vec3<f16> = (a + b);
}

View File

@ -0,0 +1,7 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = 1.h;
let b = 2.h;
let r : f16 = a / b;
}

View File

@ -0,0 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const float16_t r = (float16_t(1.0h) / float16_t(2.0h));
return;
}

View File

@ -0,0 +1,10 @@
SKIP: FAILED
[numthreads(1, 1, 1)]
void f() {
const float16_t r = (float16_t(1.0h) / float16_t(2.0h));
return;
}
FXC validation failure:
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000232390C4180(3,9-17): error X3000: unrecognized identifier 'float16_t'

View File

@ -0,0 +1,12 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
void f() {
float16_t r = (1.0hf / 2.0hf);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
half const a = 1.0h;
half const b = 2.0h;
half const r = (a / b);
return;
}

View File

@ -0,0 +1,24 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 9
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%half = OpTypeFloat 16
%half_0x1p_0 = OpConstant %half 0x1p+0
%half_0x1p_1 = OpConstant %half 0x1p+1
%f = OpFunction %void None %1
%4 = OpLabel
%8 = OpFDiv %half %half_0x1p_0 %half_0x1p_1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,8 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = 1.0h;
let b = 2.0h;
let r : f16 = (a / b);
}

View File

@ -0,0 +1,7 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = 4.h;
let b = vec3<f16>(1.h, 2.h, 3.h);
let r : vec3<f16> = a / b;
}

View File

@ -0,0 +1,7 @@
[numthreads(1, 1, 1)]
void f() {
const float16_t a = float16_t(4.0h);
const vector<float16_t, 3> b = vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h));
const vector<float16_t, 3> r = (a / b);
return;
}

View File

@ -0,0 +1,12 @@
SKIP: FAILED
[numthreads(1, 1, 1)]
void f() {
const float16_t a = float16_t(4.0h);
const vector<float16_t, 3> b = vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h));
const vector<float16_t, 3> r = (a / b);
return;
}
FXC validation failure:
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001DE5F7F2A90(3,9-17): error X3000: unrecognized identifier 'float16_t'

View File

@ -0,0 +1,14 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
void f() {
float16_t a = 4.0hf;
f16vec3 b = f16vec3(1.0hf, 2.0hf, 3.0hf);
f16vec3 r = (a / b);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
half const a = 4.0h;
half3 const b = half3(1.0h, 2.0h, 3.0h);
half3 const r = (a / b);
return;
}

View File

@ -0,0 +1,32 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 17
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%half = OpTypeFloat 16
%half_0x1p_2 = OpConstant %half 0x1p+2
%v3half = OpTypeVector %half 3
%half_0x1p_0 = OpConstant %half 0x1p+0
%half_0x1p_1 = OpConstant %half 0x1p+1
%half_0x1_8p_1 = OpConstant %half 0x1.8p+1
%11 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1
%_ptr_Function_v3half = OpTypePointer Function %v3half
%15 = OpConstantNull %v3half
%f = OpFunction %void None %1
%4 = OpLabel
%13 = OpVariable %_ptr_Function_v3half Function %15
%16 = OpCompositeConstruct %v3half %half_0x1p_2 %half_0x1p_2 %half_0x1p_2
%12 = OpFDiv %v3half %16 %11
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,8 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = 4.0h;
let b = vec3<f16>(1.0h, 2.0h, 3.0h);
let r : vec3<f16> = (a / b);
}

View File

@ -0,0 +1,7 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = vec3<f16>(1.h, 2.h, 3.h);
let b = 4.h;
let r : vec3<f16> = a / b;
}

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void f() {
const vector<float16_t, 3> a = vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h));
const vector<float16_t, 3> r = (a / float16_t(4.0h));
return;
}

View File

@ -0,0 +1,12 @@
SKIP: FAILED
[numthreads(1, 1, 1)]
void f() {
const vector<float16_t, 3> a = vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h));
const vector<float16_t, 3> r = (a / float16_t(4.0h));
return;
}
FXC validation failure:
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001FA1E656B40(3,16-24): error X3000: syntax error: unexpected token 'float16_t'
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001FA1E656B40(4,16-24): error X3000: syntax error: unexpected token 'float16_t'

View File

@ -0,0 +1,13 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
void f() {
f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf);
f16vec3 r = (a / 4.0hf);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
half3 const a = half3(1.0h, 2.0h, 3.0h);
half const b = 4.0h;
half3 const r = (a / b);
return;
}

View File

@ -0,0 +1,32 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 17
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%half_0x1p_0 = OpConstant %half 0x1p+0
%half_0x1p_1 = OpConstant %half 0x1p+1
%half_0x1_8p_1 = OpConstant %half 0x1.8p+1
%10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1
%half_0x1p_2 = OpConstant %half 0x1p+2
%_ptr_Function_v3half = OpTypePointer Function %v3half
%15 = OpConstantNull %v3half
%f = OpFunction %void None %1
%4 = OpLabel
%13 = OpVariable %_ptr_Function_v3half Function %15
%16 = OpCompositeConstruct %v3half %half_0x1p_2 %half_0x1p_2 %half_0x1p_2
%12 = OpFDiv %v3half %10 %16
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,8 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = vec3<f16>(1.0h, 2.0h, 3.0h);
let b = 4.0h;
let r : vec3<f16> = (a / b);
}

View File

@ -0,0 +1,7 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = vec3<f16>(1.h, 2.h, 3.h);
let b = vec3<f16>(4.h, 5.h, 6.h);
let r : vec3<f16> = a / b;
}

View File

@ -0,0 +1,7 @@
[numthreads(1, 1, 1)]
void f() {
const vector<float16_t, 3> a = vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h));
const vector<float16_t, 3> b = vector<float16_t, 3>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h));
const vector<float16_t, 3> r = (a / b);
return;
}

View File

@ -0,0 +1,14 @@
SKIP: FAILED
[numthreads(1, 1, 1)]
void f() {
const vector<float16_t, 3> a = vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h));
const vector<float16_t, 3> b = vector<float16_t, 3>(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h));
const vector<float16_t, 3> r = (a / b);
return;
}
FXC validation failure:
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002A238932BC0(3,16-24): error X3000: syntax error: unexpected token 'float16_t'
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002A238932BC0(4,16-24): error X3000: syntax error: unexpected token 'float16_t'
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002A238932BC0(5,16-24): error X3000: syntax error: unexpected token 'float16_t'

View File

@ -0,0 +1,14 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
void f() {
f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf);
f16vec3 b = f16vec3(4.0hf, 5.0hf, 6.0hf);
f16vec3 r = (a / b);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
half3 const a = half3(1.0h, 2.0h, 3.0h);
half3 const b = half3(4.0h, 5.0h, 6.0h);
half3 const r = (a / b);
return;
}

View File

@ -0,0 +1,31 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 16
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%half_0x1p_0 = OpConstant %half 0x1p+0
%half_0x1p_1 = OpConstant %half 0x1p+1
%half_0x1_8p_1 = OpConstant %half 0x1.8p+1
%10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1
%half_0x1p_2 = OpConstant %half 0x1p+2
%half_0x1_4p_2 = OpConstant %half 0x1.4p+2
%half_0x1_8p_2 = OpConstant %half 0x1.8p+2
%14 = OpConstantComposite %v3half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2
%f = OpFunction %void None %1
%4 = OpLabel
%15 = OpFDiv %v3half %10 %14
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,8 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = vec3<f16>(1.0h, 2.0h, 3.0h);
let b = vec3<f16>(4.0h, 5.0h, 6.0h);
let r : vec3<f16> = (a / b);
}

View File

@ -0,0 +1,7 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = 1.h;
let b = 0.h;
let r : f16 = a / b;
}

View File

@ -0,0 +1,5 @@
[numthreads(1, 1, 1)]
void f() {
const float16_t r = (float16_t(1.0h) / float16_t(0.0h));
return;
}

View File

@ -0,0 +1,10 @@
SKIP: FAILED
[numthreads(1, 1, 1)]
void f() {
const float16_t r = (float16_t(1.0h) / float16_t(0.0h));
return;
}
FXC validation failure:
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001E4C7696450(3,9-17): error X3000: unrecognized identifier 'float16_t'

View File

@ -0,0 +1,12 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
void f() {
float16_t r = (1.0hf / 0.0hf);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
half const a = 1.0h;
half const b = 0.0h;
half const r = (a / b);
return;
}

View File

@ -0,0 +1,24 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 9
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%half = OpTypeFloat 16
%half_0x1p_0 = OpConstant %half 0x1p+0
%7 = OpConstantNull %half
%f = OpFunction %void None %1
%4 = OpLabel
%8 = OpFDiv %half %half_0x1p_0 %7
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,8 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = 1.0h;
let b = 0.0h;
let r : f16 = (a / b);
}

View File

@ -0,0 +1,7 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = 4.h;
let b = vec3<f16>(0.h, 2.h, 0.h);
let r : vec3<f16> = a / b;
}

View File

@ -0,0 +1,7 @@
[numthreads(1, 1, 1)]
void f() {
const float16_t a = float16_t(4.0h);
const vector<float16_t, 3> b = vector<float16_t, 3>(float16_t(0.0h), float16_t(2.0h), float16_t(0.0h));
const vector<float16_t, 3> r = (a / b);
return;
}

View File

@ -0,0 +1,12 @@
SKIP: FAILED
[numthreads(1, 1, 1)]
void f() {
const float16_t a = float16_t(4.0h);
const vector<float16_t, 3> b = vector<float16_t, 3>(float16_t(0.0h), float16_t(2.0h), float16_t(0.0h));
const vector<float16_t, 3> r = (a / b);
return;
}
FXC validation failure:
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001A1C20B2D10(3,9-17): error X3000: unrecognized identifier 'float16_t'

View File

@ -0,0 +1,14 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
void f() {
float16_t a = 4.0hf;
f16vec3 b = f16vec3(0.0hf, 2.0hf, 0.0hf);
f16vec3 r = (a / b);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
half const a = 4.0h;
half3 const b = half3(0.0h, 2.0h, 0.0h);
half3 const r = (a / b);
return;
}

View File

@ -0,0 +1,31 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 16
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%half = OpTypeFloat 16
%half_0x1p_2 = OpConstant %half 0x1p+2
%v3half = OpTypeVector %half 3
%8 = OpConstantNull %half
%half_0x1p_1 = OpConstant %half 0x1p+1
%10 = OpConstantComposite %v3half %8 %half_0x1p_1 %8
%_ptr_Function_v3half = OpTypePointer Function %v3half
%14 = OpConstantNull %v3half
%f = OpFunction %void None %1
%4 = OpLabel
%12 = OpVariable %_ptr_Function_v3half Function %14
%15 = OpCompositeConstruct %v3half %half_0x1p_2 %half_0x1p_2 %half_0x1p_2
%11 = OpFDiv %v3half %15 %10
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,8 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = 4.0h;
let b = vec3<f16>(0.0h, 2.0h, 0.0h);
let r : vec3<f16> = (a / b);
}

View File

@ -0,0 +1,7 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = vec3<f16>(1.h, 2.h, 3.h);
let b = 0.h;
let r : vec3<f16> = a / b;
}

View File

@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void f() {
const vector<float16_t, 3> a = vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h));
const vector<float16_t, 3> r = (a / float16_t(0.0h));
return;
}

View File

@ -0,0 +1,12 @@
SKIP: FAILED
[numthreads(1, 1, 1)]
void f() {
const vector<float16_t, 3> a = vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h));
const vector<float16_t, 3> r = (a / float16_t(0.0h));
return;
}
FXC validation failure:
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000198035B3410(3,16-24): error X3000: syntax error: unexpected token 'float16_t'
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000198035B3410(4,16-24): error X3000: syntax error: unexpected token 'float16_t'

View File

@ -0,0 +1,13 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
void f() {
f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf);
f16vec3 r = (a / 0.0hf);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
half3 const a = half3(1.0h, 2.0h, 3.0h);
half const b = 0.0h;
half3 const r = (a / b);
return;
}

View File

@ -0,0 +1,32 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 17
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%half_0x1p_0 = OpConstant %half 0x1p+0
%half_0x1p_1 = OpConstant %half 0x1p+1
%half_0x1_8p_1 = OpConstant %half 0x1.8p+1
%10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1
%11 = OpConstantNull %half
%_ptr_Function_v3half = OpTypePointer Function %v3half
%15 = OpConstantNull %v3half
%f = OpFunction %void None %1
%4 = OpLabel
%13 = OpVariable %_ptr_Function_v3half Function %15
%16 = OpCompositeConstruct %v3half %11 %11 %11
%12 = OpFDiv %v3half %10 %16
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,8 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = vec3<f16>(1.0h, 2.0h, 3.0h);
let b = 0.0h;
let r : vec3<f16> = (a / b);
}

View File

@ -0,0 +1,7 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = vec3<f16>(1.h, 2.h, 3.h);
let b = vec3<f16>(0.h, 5.h, 0.h);
let r : vec3<f16> = a / b;
}

View File

@ -0,0 +1,7 @@
[numthreads(1, 1, 1)]
void f() {
const vector<float16_t, 3> a = vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h));
const vector<float16_t, 3> b = vector<float16_t, 3>(float16_t(0.0h), float16_t(5.0h), float16_t(0.0h));
const vector<float16_t, 3> r = (a / b);
return;
}

View File

@ -0,0 +1,14 @@
SKIP: FAILED
[numthreads(1, 1, 1)]
void f() {
const vector<float16_t, 3> a = vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h));
const vector<float16_t, 3> b = vector<float16_t, 3>(float16_t(0.0h), float16_t(5.0h), float16_t(0.0h));
const vector<float16_t, 3> r = (a / b);
return;
}
FXC validation failure:
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002160BCD37C0(3,16-24): error X3000: syntax error: unexpected token 'float16_t'
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002160BCD37C0(4,16-24): error X3000: syntax error: unexpected token 'float16_t'
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002160BCD37C0(5,16-24): error X3000: syntax error: unexpected token 'float16_t'

View File

@ -0,0 +1,14 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
void f() {
f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf);
f16vec3 b = f16vec3(0.0hf, 5.0hf, 0.0hf);
f16vec3 r = (a / b);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
half3 const a = half3(1.0h, 2.0h, 3.0h);
half3 const b = half3(0.0h, 5.0h, 0.0h);
half3 const r = (a / b);
return;
}

View File

@ -0,0 +1,30 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 15
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
%half_0x1p_0 = OpConstant %half 0x1p+0
%half_0x1p_1 = OpConstant %half 0x1p+1
%half_0x1_8p_1 = OpConstant %half 0x1.8p+1
%10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1
%11 = OpConstantNull %half
%half_0x1_4p_2 = OpConstant %half 0x1.4p+2
%13 = OpConstantComposite %v3half %11 %half_0x1_4p_2 %11
%f = OpFunction %void None %1
%4 = OpLabel
%14 = OpFDiv %v3half %10 %13
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,8 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
let a = vec3<f16>(1.0h, 2.0h, 3.0h);
let b = vec3<f16>(0.0h, 5.0h, 0.0h);
let r : vec3<f16> = (a / b);
}

View File

@ -0,0 +1,7 @@
enable f16;
@compute @workgroup_size(1)
fn f() {
var a = 1.h;
var b = 0.h;
let r : f16 = a / (b + b);
}

View File

@ -0,0 +1,7 @@
[numthreads(1, 1, 1)]
void f() {
float16_t a = float16_t(1.0h);
float16_t b = float16_t(0.0h);
const float16_t r = (a / (b + b));
return;
}

View File

@ -0,0 +1,13 @@
SKIP: FAILED
[numthreads(1, 1, 1)]
void f() {
float16_t a = float16_t(1.0h);
float16_t b = float16_t(0.0h);
const float16_t r = (a / (b + b));
return;
}
FXC validation failure:
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000154BF386B50(3,3-11): error X3000: unrecognized identifier 'float16_t'
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000154BF386B50(3,13): error X3000: unrecognized identifier 'a'

View File

@ -0,0 +1,14 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
void f() {
float16_t a = 1.0hf;
float16_t b = 0.0hf;
float16_t r = (a / (b + b));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void f() {
half a = 1.0h;
half b = 0.0h;
half const r = (a / (b + b));
return;
}

View File

@ -0,0 +1,35 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 16
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %f "f"
OpName %a "a"
OpName %b "b"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%half = OpTypeFloat 16
%half_0x1p_0 = OpConstant %half 0x1p+0
%_ptr_Function_half = OpTypePointer Function %half
%9 = OpConstantNull %half
%f = OpFunction %void None %1
%4 = OpLabel
%a = OpVariable %_ptr_Function_half Function %9
%b = OpVariable %_ptr_Function_half Function %9
OpStore %a %half_0x1p_0
OpStore %b %9
%11 = OpLoad %half %a
%12 = OpLoad %half %b
%13 = OpLoad %half %b
%14 = OpFAdd %half %12 %13
%15 = OpFDiv %half %11 %14
OpReturn
OpFunctionEnd

Some files were not shown because too many files have changed in this diff Show More