mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-14 07:36:15 +00:00
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:
committed by
Dawn LUCI CQ
parent
7d04cedce3
commit
7d7976d590
4
test/tint/expressions/zero_init/array/f16.wgsl
Normal file
4
test/tint/expressions/zero_init/array/f16.wgsl
Normal file
@@ -0,0 +1,4 @@
|
||||
enable f16;
|
||||
fn f() {
|
||||
var v = array<f16, 4>();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
|
||||
void f() {
|
||||
float16_t v[4] = (float16_t[4])0;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
SKIP: FAILED
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
|
||||
void f() {
|
||||
float16_t v[4] = (float16_t[4])0;
|
||||
}
|
||||
FXC validation failure:
|
||||
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001C7D06B43D0(7,3-11): error X3000: unrecognized identifier 'float16_t'
|
||||
D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001C7D06B43D0(7,13): error X3000: unrecognized identifier 'v'
|
||||
|
||||
11
test/tint/expressions/zero_init/array/f16.wgsl.expected.glsl
Normal file
11
test/tint/expressions/zero_init/array/f16.wgsl.expected.glsl
Normal file
@@ -0,0 +1,11 @@
|
||||
#version 310 es
|
||||
#extension GL_AMD_gpu_shader_half_float : require
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
void f() {
|
||||
float16_t v[4] = float16_t[4](0.0hf, 0.0hf, 0.0hf, 0.0hf);
|
||||
}
|
||||
|
||||
20
test/tint/expressions/zero_init/array/f16.wgsl.expected.msl
Normal file
20
test/tint/expressions/zero_init/array/f16.wgsl.expected.msl
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct tint_array {
|
||||
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
||||
device T& operator[](size_t i) device { return elements[i]; }
|
||||
const device T& operator[](size_t i) const device { return elements[i]; }
|
||||
thread T& operator[](size_t i) thread { return elements[i]; }
|
||||
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
||||
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
||||
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
||||
T elements[N];
|
||||
};
|
||||
|
||||
void f() {
|
||||
tint_array<half, 4> v = tint_array<half, 4>{};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 14
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability Float16
|
||||
OpCapability UniformAndStorageBuffer16BitAccess
|
||||
OpCapability StorageBuffer16BitAccess
|
||||
OpCapability StorageInputOutput16
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||
OpName %unused_entry_point "unused_entry_point"
|
||||
OpName %f "f"
|
||||
OpName %v "v"
|
||||
OpDecorate %_arr_half_uint_4 ArrayStride 2
|
||||
%void = OpTypeVoid
|
||||
%1 = OpTypeFunction %void
|
||||
%half = OpTypeFloat 16
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_half_uint_4 = OpTypeArray %half %uint_4
|
||||
%11 = OpConstantNull %_arr_half_uint_4
|
||||
%_ptr_Function__arr_half_uint_4 = OpTypePointer Function %_arr_half_uint_4
|
||||
%unused_entry_point = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%f = OpFunction %void None %1
|
||||
%6 = OpLabel
|
||||
%v = OpVariable %_ptr_Function__arr_half_uint_4 Function %11
|
||||
OpStore %v %11
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,5 @@
|
||||
enable f16;
|
||||
|
||||
fn f() {
|
||||
var v = array<f16, 4>();
|
||||
}
|
||||
Reference in New Issue
Block a user