Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,16 @@ Buffers:
- Name: Out1 # Buffer where our output will go
Format: Float32
Stride: 4
ZeroInitSize: 8
FillSize: 8
FillValue: 0.0 # The FillValue is optional and defaults to zero
- Name: Expected1 # Buffer which stores the expected result of our test
Format: Float32
Stride: 4
Data: [ 0.0, 1.0 ]
- Name: Out2 # Buffer where our output will go
Format: Float16
Stride: 2
ZeroInitSize: 4 # ZeroInitSize needs to be 4 bytes minimum
FillSize: 4 # FillSize needs to be 4 bytes minimum
- Name: Expected2 # Buffer which stores the expected result of our test
Format: Float16
Stride: 2
Expand Down
30 changes: 24 additions & 6 deletions lib/Support/Pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,34 @@ template <typename T> static void setData(IO &I, offloadtest::Buffer &B) {
return;
}

// zero-initialized buffer(s)
int64_t ZeroInitSize;
I.mapOptional("ZeroInitSize", ZeroInitSize, 0);
if (ZeroInitSize > 0) {
B.Size = ZeroInitSize;
// Buffers can be initialized to be filled with a fixed value.
int64_t FillSize;

// Explicitly reject ZeroInitSize to avoid a confusing error while
// transitioning to FillSize. We can remove this once in flight PRs have had
// time to go in.
I.mapOptional("ZeroInitSize", FillSize, 0);
if (FillSize > 0) {
I.setError("invalid key 'ZeroInitSize' - did you mean 'FillSize'?");
return;
}

T FillValue;
I.mapOptional("FillSize", FillSize, 0);
I.mapOptional("FillValue", FillValue, T{});
if (FillSize > 0) {
B.Size = FillSize;
llvm::SmallVector<T> FillData(FillSize);
std::fill(FillData.begin(), FillData.end(), FillValue);

for (uint32_t I = 0; I < B.ArraySize; I++) {
B.Data.push_back(std::make_unique<char[]>(B.Size));
memset(B.Data.back().get(), 0, B.Size);
memcpy(B.Data.back().get(), FillData.data(), B.Size);
}
return;
} else if (FillValue) {
I.setError("'FillValue' specified without 'FillSize'");
return;
}

// single buffer input
Expand Down
4 changes: 2 additions & 2 deletions test/Basic/DescriptorSets.test
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ Buffers:
- Name: Out1
Format: Float32
Channels: 4
ZeroInitSize: 16
FillSize: 16
- Name: Out2
Format: Float32
Channels: 4
ZeroInitSize: 16
FillSize: 16
DescriptorSets:
- Resources:
- Name: In
Expand Down
2 changes: 1 addition & 1 deletion test/Basic/Mandelbrot.test
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Buffers:
- Name: Tex
Format: Float32
Channels: 4
ZeroInitSize: 268435456 # 1024 * 1024 * 4 channels / pixel * 4 bytes / channel
FillSize: 268435456 # 1024 * 1024 * 4 channels / pixel * 4 bytes / channel
OutputProps:
Height: 4096
Width: 4096
Expand Down
2 changes: 1 addition & 1 deletion test/Basic/matrix_m-based_getter.test
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Buffers:
Data: [ 1, 2, 3, 4]
- Name: Out
Format: Int32
ZeroInitSize: 16
FillSize: 16
- Name: ExpectedOut
Format: Int32
Data: [ 1, 2, 3, 4 ]
Expand Down
2 changes: 1 addition & 1 deletion test/Basic/matrix_one-based_getter.test
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Buffers:
Data: [ 1, 2, 3, 4]
- Name: Out
Format: Int32
ZeroInitSize: 16
FillSize: 16
- Name: ExpectedOut
Format: Int32
Data: [ 1, 2, 3, 4 ]
Expand Down
8 changes: 4 additions & 4 deletions test/Basic/matrix_scalar_arithmetic.test
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ Buffers:
Data: [ 2, 4, 6, 8, 10, 12 ]
- Name: DivOut
Format: Int32
ZeroInitSize: 24
FillSize: 24
- Name: MulOut
Format: Int32
ZeroInitSize: 24
FillSize: 24
- Name: AddOut
Format: Int32
ZeroInitSize: 24
FillSize: 24
- Name: SubOut
Format: Int32
ZeroInitSize: 24
FillSize: 24
DescriptorSets:
- Resources:
- Name: In
Expand Down
8 changes: 4 additions & 4 deletions test/Basic/matrix_scalar_constructor.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ RWBuffer<int> Out : register(u1);

[numthreads(6,1,1)]
void main(uint GI : SV_GroupIndex) {
int2x3 A = int2x3(In[0], In[1], In[2],
In[3], In[4], In[5]);
int2x3 A = int2x3(In[0], In[1], In[2],
In[3], In[4], In[5]);

int row = GI / 2;
int col = GI % 2;
Out[GI] = A[col][row];
Expand All @@ -26,7 +26,7 @@ Buffers:
Data: [ 1, 2, 3, 4, 5, 6]
- Name: Out
Format: Int32
ZeroInitSize: 24
FillSize: 24
- Name: ExpectedOut
Format: Int32
Data: [ 1, 4, 2, 5, 3, 6 ]
Expand Down
2 changes: 1 addition & 1 deletion test/Basic/simple.test
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Buffers:
- Name: Out
Format: Float32
Channels: 4
ZeroInitSize: 16
FillSize: 16
DescriptorSets:
- Resources:
- Name: In
Expand Down
2 changes: 1 addition & 1 deletion test/Bugs/UAV-Sequental-Consistency.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Buffers:
- Name: Result
Format: Int32
Stride: 4
ZeroInitSize: 16
FillSize: 16
- Name: ExpectedResult
Format: Int32
Stride: 4
Expand Down
2 changes: 1 addition & 1 deletion test/Feature/Attributes/IfBranchAttr.test
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Buffers:
Data: [ 1, 4, 9, 16, 25, 36, 49, 64]
- Name: Out
Format: Int32
ZeroInitSize: 32
FillSize: 32
DescriptorSets:
- Resources:
- Name: In
Expand Down
2 changes: 1 addition & 1 deletion test/Feature/Attributes/IfBranchFlatten.test
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Buffers:
Data: [ 1, 4, 9, 16, 25, 36, 49, 64]
- Name: Out
Format: Int32
ZeroInitSize: 32
FillSize: 32
DescriptorSets:
- Resources:
- Name: In
Expand Down
4 changes: 2 additions & 2 deletions test/Feature/ByteAddressBuffer/ByteAddressBuffers.test
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ Buffers:

- Name: OutBuf
Format: Hex32
ZeroInitSize: 64
FillSize: 64

- Name: MappedBuf
Format: Int32
ZeroInitSize: 16
FillSize: 16

DescriptorSets:
- Resources:
Expand Down
2 changes: 1 addition & 1 deletion test/Feature/ByteAddressBuffer/GetDimensions.test
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Buffers:

- Name: Out
Format: Int32
ZeroInitSize: 8
FillSize: 8

- Name: ExpectedOut
Format: Int32
Expand Down
2 changes: 1 addition & 1 deletion test/Feature/CBuffer/array-vec-index.test
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Buffers:
]
- Name: Out
Format: UInt32
ZeroInitSize: 8
FillSize: 8
- Name: ExpectedOut
Format: UInt32
Data: [ 8, 11 ]
Expand Down
2 changes: 1 addition & 1 deletion test/Feature/CBuffer/arrays-16bit.test
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Buffers:
# Warp doesn't seem to like buffers with non-multiple of 4 strides, so we
# add a small amount of buffer at the end here.
Stride: 28
ZeroInitSize: 28
FillSize: 28
- Name: ExpectedOut
Format: Hex16
Stride: 26
Expand Down
2 changes: 1 addition & 1 deletion test/Feature/CBuffer/arrays-64bit.test
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Buffers:
- Name: Out
Format: Hex64
Stride: 128
ZeroInitSize: 128
FillSize: 128
- Name: ExpectedOut
Format: Hex64
Stride: 128
Expand Down
2 changes: 1 addition & 1 deletion test/Feature/CBuffer/arrays.test
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Buffers:
- Name: Out
Format: Hex32
Stride: 128
ZeroInitSize: 128
FillSize: 128
- Name: ExpectedOut
Format: Hex32
Stride: 128
Expand Down
2 changes: 1 addition & 1 deletion test/Feature/CBuffer/scalars-16bit.test
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Buffers:
Format: Hex16
# Warp doesn't seem to be able to handle a stride of 6 so we use 8 here...
Stride: 8
ZeroInitSize: 8
FillSize: 8
DescriptorSets:
- Resources:
- Name: CBScalars
Expand Down
2 changes: 1 addition & 1 deletion test/Feature/CBuffer/scalars-64bit.test
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Buffers:
- Name: Out
Format: Hex64
Stride: 24
ZeroInitSize: 24
FillSize: 24
DescriptorSets:
- Resources:
- Name: CBScalars
Expand Down
2 changes: 1 addition & 1 deletion test/Feature/CBuffer/scalars.test
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Buffers:
- Name: Out
Format: Hex32
Stride: 12
ZeroInitSize: 12
FillSize: 12
DescriptorSets:
- Resources:
- Name: CBScalars
Expand Down
2 changes: 1 addition & 1 deletion test/Feature/CBuffer/structs.test
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Buffers:
- Name: Out
Format: Hex32
Stride: 60
ZeroInitSize: 60
FillSize: 60
DescriptorSets:
- Resources:
- Name: CBVectors
Expand Down
2 changes: 1 addition & 1 deletion test/Feature/CBuffer/vectors-16bit.test
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Buffers:
Format: Hex16
# Warp doesn't seem to be able to handle a stride of 10 so we use 12 here
Stride: 12
ZeroInitSize: 12
FillSize: 12
DescriptorSets:
- Resources:
- Name: CBVectors
Expand Down
2 changes: 1 addition & 1 deletion test/Feature/CBuffer/vectors-64bit.test
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Buffers:
- Name: Out
Format: Hex64
Stride: 72
ZeroInitSize: 72
FillSize: 72
DescriptorSets:
- Resources:
- Name: CBVectors
Expand Down
2 changes: 1 addition & 1 deletion test/Feature/CBuffer/vectors.test
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Buffers:
- Name: Out
Format: Hex32
Stride: 52
ZeroInitSize: 52
FillSize: 52
DescriptorSets:
- Resources:
- Name: CBVectors
Expand Down
2 changes: 1 addition & 1 deletion test/Feature/HLSLLib/D3DCOLORtoUBYTE4.test
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Buffers:
- Name: Out0
Format: UInt32
Stride: 16
ZeroInitSize: 32
FillSize: 32
- Name: ExpectedOut0
Format: UInt32
Stride: 16
Expand Down
6 changes: 3 additions & 3 deletions test/Feature/HLSLLib/abs.32.test
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,23 @@ Buffers:
- Name: Out1
Format: Int32
Stride: 16
ZeroInitSize: 48
FillSize: 48
- Name: ExpectedOut1 # The result we expect
Format: Int32
Stride: 16
Data: [1, 0, -2147483648, 2147483647, 1, 0, -2147483648, 2147483647, 1, 0, 0, 0] # Last two are filler
- Name: Out2
Format: UInt32
Stride: 16
ZeroInitSize: 48
FillSize: 48
- Name: ExpectedOut2 # The result we expect
Format: UInt32
Stride: 16
Data: [1, 4294967295, 0, 10, 1, 4294967295, 0, 10, 1, 4294967295, 0, 0] # Last two are filler
- Name: Out3
Format: Float32
Stride: 16
ZeroInitSize: 48
FillSize: 48
- Name: ExpectedOut3 # The result we expect
Format: Float32
Stride: 16
Expand Down
2 changes: 1 addition & 1 deletion test/Feature/HLSLLib/abs.fp16.test
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Buffers:
- Name: Out1
Format: Float16
Stride: 8
ZeroInitSize: 24
FillSize: 24
- Name: ExpectedOut1 # The result we expect
Format: Float16
Stride: 8
Expand Down
2 changes: 1 addition & 1 deletion test/Feature/HLSLLib/abs.fp64.test
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Buffers:
- Name: Out1
Format: Float64
Stride: 32
ZeroInitSize: 96
FillSize: 96
- Name: ExpectedOut1 # The result we expect
Format: Float64
Stride: 32
Expand Down
4 changes: 2 additions & 2 deletions test/Feature/HLSLLib/abs.int16.test
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ Buffers:
- Name: Out1
Format: Int16
Stride: 8
ZeroInitSize: 24
FillSize: 24
- Name: ExpectedOut1 # The result we expect
Format: Int16
Stride: 8
Data: [1, 0, -32768, 32767, 1, 0, -32768, 32767, 1, 0, 0, 0] # Last two are filler
- Name: Out2
Format: UInt16
Stride: 8
ZeroInitSize: 24
FillSize: 24
- Name: ExpectedOut2 # The result we expect
Format: UInt16
Stride: 8
Expand Down
4 changes: 2 additions & 2 deletions test/Feature/HLSLLib/abs.int64.test
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ Buffers:
- Name: Out1
Format: Int64
Stride: 32
ZeroInitSize: 96
FillSize: 96
- Name: ExpectedOut1 # The result we expect
Format: Int64
Stride: 32
Data: [1, 0, -9223372036854775808, 9223372036854775807, 1, 0, -9223372036854775808, 9223372036854775807, 1, 0, 0, 0] # Last two are filler
- Name: Out2
Format: UInt64
Stride: 32
ZeroInitSize: 96
FillSize: 96
- Name: ExpectedOut2 # The result we expect
Format: UInt64
Stride: 32
Expand Down
Loading
Loading