Skip to content

Commit 55dbab2

Browse files
committed
Test workflow run
1 parent d11a3e6 commit 55dbab2

File tree

338 files changed

+37158
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

338 files changed

+37158
-2
lines changed

.github/workflows/build-and-test-callable.yaml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,14 @@ jobs:
155155
cd DXC
156156
mkdir build
157157
cd build
158-
cmake -G Ninja -DCMAKE_BUILD_TYPE=${{ inputs.BuildType }} -DLLVM_ENABLE_ASSERTIONS=On -C ${{ github.workspace }}/DXC/cmake/caches/PredefinedParams.cmake -C ${{ github.workspace }}/OffloadTest/cmake/caches/sccache.cmake -DHLSL_DISABLE_SOURCE_GENERATION=On ${{ github.workspace }}/DXC/
158+
cmake -G Ninja -DCMAKE_BUILD_TYPE=${{ inputs.BuildType }} -DLLVM_ENABLE_ASSERTIONS=On -C ${{ github.workspace }}/DXC/cmake/caches/PredefinedParams.cmake -C ${{ github.workspace }}/OffloadTest/cmake/caches/sccache.cmake -DHLSL_DISABLE_SOURCE_GENERATION=On -DLLVM_LIT_ARGS="--xunit-xml-output=testresults.xunit.xml -v --filter-out=Feature/MaximalReconvergence" ${{ github.workspace }}/DXC/
159159
ninja
160160
- name: Build LLVM
161161
run: |
162162
cd llvm-project
163163
mkdir build
164164
cd build
165-
cmake -G Ninja ${{ inputs.LLVM-ExtraCMakeArgs }} -DCMAKE_BUILD_TYPE=${{ inputs.BuildType }} -DLLVM_ENABLE_ASSERTIONS=On -C ${{ github.workspace }}/llvm-project/clang/cmake/caches/HLSL.cmake -C ${{ github.workspace }}/OffloadTest/cmake/caches/sccache.cmake -DDXC_DIR=${{ github.workspace }}/DXC/build/bin -DLLVM_EXTERNAL_OFFLOADTEST_SOURCE_DIR=${{ github.workspace }}/OffloadTest -DLLVM_EXTERNAL_PROJECTS="OffloadTest" -DLLVM_LIT_ARGS="--xunit-xml-output=testresults.xunit.xml -v" -DOFFLOADTEST_TEST_CLANG=${{steps.Test-Clang.outputs.TEST_CLANG || 'Off' }} -DGOLDENIMAGE_DIR=${{ github.workspace }}/golden-images ${{ github.workspace }}/llvm-project/llvm/
165+
cmake -G Ninja ${{ inputs.LLVM-ExtraCMakeArgs }} -DCMAKE_BUILD_TYPE=${{ inputs.BuildType }} -DLLVM_ENABLE_ASSERTIONS=On -C ${{ github.workspace }}/llvm-project/clang/cmake/caches/HLSL.cmake -C ${{ github.workspace }}/OffloadTest/cmake/caches/sccache.cmake -DDXC_DIR=${{ github.workspace }}/DXC/build/bin -DLLVM_EXTERNAL_OFFLOADTEST_SOURCE_DIR=${{ github.workspace }}/OffloadTest -DLLVM_EXTERNAL_PROJECTS="OffloadTest" -DLLVM_LIT_ARGS="--xunit-xml-output=testresults.xunit.xml -v --filter-out=Feature/MaximalReconvergence" -DOFFLOADTEST_TEST_CLANG=${{steps.Test-Clang.outputs.TEST_CLANG || 'Off' }} -DGOLDENIMAGE_DIR=${{ github.workspace }}/golden-images ${{ github.workspace }}/llvm-project/llvm/
166166
ninja hlsl-test-depends
167167
- name: Dump GPU Info
168168
run: |
@@ -175,12 +175,33 @@ jobs:
175175
cd build
176176
ninja check-hlsl-unit
177177
ninja ${{ inputs.TestTarget }}
178+
- name: Generate maximal Reconvergence Tests
179+
if: always()
180+
run: |
181+
rm -rf OffloadTest/tools/TestGenerator/reconvergence/tests/*
182+
cd OffloadTest/tools/TestGenerator/reconvergence
183+
cmake -G Ninja -B build/
184+
ninja -C build
185+
- name: Run Maximal Reconvergence Test
186+
if: always()
187+
env:
188+
OFFLOADTEST_SUPPRESS_DIFF: 1
189+
run: |
190+
cd llvm-project
191+
cd build
192+
./bin/llvm-lit -v --xunit-xml-output=testresults-max-reconv.xunit.xml ${{ github.workspace }}/OffloadTest/tools/TestGenerator/reconvergence/tests
178193
- name: Publish Test Results
179194
uses: EnricoMi/publish-unit-test-result-action/macos@v2
180195
if: always() && inputs.OS == 'macOS'
181196
with:
182197
comment_mode: off
183198
files: llvm-project/build/**/testresults.xunit.xml
199+
- name: Publish Maximal Reconvergence Test Results
200+
uses: EnricoMi/publish-unit-test-result-action/macos@v2
201+
if: always() && inputs.OS == 'macOS'
202+
with:
203+
comment_mode: off
204+
files: llvm-project/build/**/testresults-max-reconv.xunit.xml
184205
#- name: Publish Test Results
185206
# uses: EnricoMi/publish-unit-test-result-action/windows@v2
186207
# if: always() && inputs.OS == 'windows'

lib/Support/Check.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "llvm/Support/Error.h"
1717
#include "llvm/Support/raw_ostream.h"
1818
#include <cmath>
19+
#include <cstdlib>
1920
#include <sstream>
2021

2122
constexpr uint16_t Float16BitSign = 0x8000;
@@ -399,5 +400,26 @@ llvm::Error verifyResult(offloadtest::Result R) {
399400
}
400401
}
401402

403+
if (!std::getenv("OFFLOADTEST_SUPPRESS_DIFF")) {
404+
OS << "Expected:\n";
405+
llvm::yaml::Output YAMLOS(OS);
406+
YAMLOS << *R.ExpectedPtr;
407+
OS << "Got:\n";
408+
YAMLOS << *R.ActualPtr;
409+
410+
// Now print exact hex64 representations of each element of the
411+
// actual and expected buffers.
412+
413+
const std::string ExpectedBufferStr =
414+
getBufferStr(R.ExpectedPtr, R.ComparisonRule);
415+
const std::string ActualBufferStr =
416+
getBufferStr(R.ActualPtr, R.ComparisonRule);
417+
418+
OS << "Full Hex 64bit representation of Expected Buffer Values:\n"
419+
<< ExpectedBufferStr << "\n";
420+
OS << "Full Hex 64bit representation of Actual Buffer Values:\n"
421+
<< ActualBufferStr << "\n";
422+
}
423+
402424
return llvm::createStringError(Str.c_str());
403425
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#ifndef EXPERIMENTAL_USERS_CLUCIE_BALLOT_H_
2+
#define EXPERIMENTAL_USERS_CLUCIE_BALLOT_H_
3+
4+
#include <bitset>
5+
#include <cstdint>
6+
#include <ostream>
7+
8+
#include "VectorUtils.h"
9+
10+
namespace reconvergence {
11+
12+
struct Ballot : public std::bitset<128> {
13+
typedef std::bitset<128> super;
14+
15+
Ballot() : super() {}
16+
17+
Ballot(add_cref<super> ballot, uint32_t printbits = 128u)
18+
: super(ballot), m_bits(printbits) {}
19+
20+
Ballot(add_cref<UVec4> ballot, uint32_t printbits = 128u)
21+
: super(), m_bits(printbits) {
22+
*this = ballot;
23+
}
24+
25+
Ballot(uint64_t val, uint32_t printbits = 128u)
26+
: super(val), m_bits(printbits) {}
27+
28+
static Ballot withSetBit(uint32_t bit) {
29+
Ballot b;
30+
b.set(bit);
31+
return b;
32+
}
33+
34+
constexpr uint32_t size() const {
35+
return static_cast<uint32_t>(super::size());
36+
}
37+
38+
operator UVec4() const {
39+
UVec4 result;
40+
super ballot(*this);
41+
const super mask = 0xFFFFFFFF;
42+
for (uint32_t k = 0; k < 4u; ++k) {
43+
result[k] = static_cast<uint32_t>((ballot & mask).to_ulong());
44+
ballot >>= 32;
45+
}
46+
return result;
47+
}
48+
49+
add_ref<Ballot> operator=(add_cref<UVec4> vec) {
50+
for (uint32_t k = 0; k < 4u; ++k) {
51+
(*this) <<= 32;
52+
(*this) |= vec[3 - k];
53+
}
54+
return *this;
55+
}
56+
57+
protected:
58+
uint32_t m_bits;
59+
};
60+
} // namespace reconvergence
61+
62+
#endif // EXPERIMENTAL_USERS_CLUCIE_BALLOT_H_
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
#ifndef EXPERIMENTAL_USERS_CLUCIE_BALLOTS_H_
2+
#define EXPERIMENTAL_USERS_CLUCIE_BALLOTS_H_
3+
4+
#include <bitset>
5+
#include <cassert>
6+
#include <cstdint>
7+
#include <vector>
8+
9+
#include "Ballot.h"
10+
#include "VectorUtils.h"
11+
12+
namespace reconvergence {
13+
struct Ballots : protected std::vector<std::bitset<128>> {
14+
typedef std::vector<value_type> super;
15+
16+
static const constexpr uint32_t subgroupInvocationSize =
17+
static_cast<uint32_t>(value_type().size());
18+
19+
Ballots() : super() {}
20+
21+
explicit Ballots(uint32_t subgroupCount, const value_type &ballot = {})
22+
: super(subgroupCount) {
23+
if (ballot.any())
24+
*this = ballot;
25+
}
26+
27+
Ballots(const Ballots &other) : super(upcast(other)) {}
28+
29+
using super::operator[];
30+
31+
using super::at;
32+
33+
/**
34+
* @brief size method
35+
* @return Returns the number of bits that the Ballots holds.
36+
*/
37+
uint32_t size() const {
38+
return static_cast<uint32_t>(super::size() * subgroupInvocationSize);
39+
}
40+
41+
/**
42+
* @brief count method
43+
* @return Returns the number of bits that are set to true.
44+
*/
45+
uint32_t count() const {
46+
uint32_t n = 0u;
47+
for (const value_type &b : *this)
48+
n += static_cast<uint32_t>(b.count());
49+
return n;
50+
}
51+
52+
/**
53+
* @brief count method
54+
* @return Returns the number of bits that are set to true in given subgroup.
55+
*/
56+
uint32_t count(uint32_t subgroup) const {
57+
assert(subgroup < subgroupCount());
58+
return static_cast<uint32_t>(at(subgroup).count());
59+
}
60+
61+
uint32_t subgroupCount() const {
62+
return static_cast<uint32_t>(super::size());
63+
}
64+
65+
bool test(uint32_t bit) const {
66+
assert(bit < size());
67+
return at(bit / subgroupInvocationSize).test(bit % subgroupInvocationSize);
68+
}
69+
70+
bool set(uint32_t bit, bool value = true) {
71+
assert(bit <= size());
72+
const bool before = test(bit);
73+
at(bit / subgroupInvocationSize).set((bit % subgroupInvocationSize), value);
74+
return before;
75+
}
76+
77+
void full() {
78+
const uint32_t bb = size();
79+
for (uint32_t b = 0u; b < bb; ++b)
80+
set(b);
81+
}
82+
83+
Ballots &setn(uint32_t bits) {
84+
for (uint32_t i = 0u; i < bits; ++i)
85+
set(i);
86+
return *this;
87+
}
88+
89+
bool all() const {
90+
const uint32_t gg = subgroupCount();
91+
for (uint32_t g = 0u; g < gg; ++g) {
92+
if (false == at(g).all())
93+
return false;
94+
}
95+
return (gg != 0u);
96+
}
97+
98+
bool none() const {
99+
const uint32_t gg = subgroupCount();
100+
for (uint32_t g = 0u; g < gg; ++g) {
101+
if (false == at(g).none())
102+
return false;
103+
}
104+
return (gg != 0u);
105+
}
106+
107+
bool any() const {
108+
bool res = false;
109+
const uint32_t gg = subgroupCount();
110+
for (uint32_t g = 0u; g < gg; ++g)
111+
res |= super::at(g).any();
112+
return res;
113+
}
114+
115+
static uint32_t findBit(uint32_t otherFullyQualifiedInvocationID,
116+
uint32_t otherSubgroupSize) {
117+
return (((otherFullyQualifiedInvocationID / otherSubgroupSize) *
118+
subgroupInvocationSize) +
119+
(otherFullyQualifiedInvocationID % otherSubgroupSize));
120+
}
121+
122+
inline const super &upcast(const Ballots &other) const {
123+
return static_cast<const super &>(other);
124+
}
125+
126+
Ballots &operator&=(const Ballots &other) {
127+
assert(subgroupCount() == other.subgroupCount());
128+
const uint32_t gg = subgroupCount();
129+
for (uint32_t g = 0u; g < gg; ++g)
130+
super::at(g) = super::at(g) & upcast(other).at(g);
131+
return *this;
132+
}
133+
134+
Ballots operator&(const Ballots &other) const {
135+
Ballots res(*this);
136+
res &= other;
137+
return res;
138+
}
139+
140+
Ballots &operator|=(const Ballots &other) {
141+
assert(subgroupCount() == other.subgroupCount());
142+
const uint32_t gg = subgroupCount();
143+
for (uint32_t g = 0u; g < gg; ++g)
144+
super::at(g) = super::at(g) | upcast(other).at(g);
145+
return *this;
146+
}
147+
148+
Ballots operator|(const Ballots &other) const {
149+
Ballots res(*this);
150+
res |= other;
151+
return res;
152+
}
153+
154+
Ballots &operator<<=(uint32_t bits) { return ((*this) = ((*this) << bits)); }
155+
156+
Ballots operator<<(uint32_t bits) const {
157+
Ballots res(subgroupCount());
158+
if (bits < size() && bits != 0u) {
159+
for (uint32_t b = 0; b < size() - bits; ++b)
160+
res.set((b + bits), test(b));
161+
}
162+
return res;
163+
}
164+
165+
Ballots operator~() const {
166+
Ballots res(*this);
167+
const uint32_t gg = subgroupCount();
168+
for (uint32_t g = 0u; g < gg; ++g)
169+
res.at(g) = super::at(g).operator~();
170+
return res;
171+
}
172+
173+
bool operator==(const Ballots &other) const {
174+
if (super::size() == upcast(other).size()) {
175+
const uint32_t gg = subgroupCount();
176+
for (uint32_t g = 0u; g < gg; ++g) {
177+
if (at(g) != other[g])
178+
return false;
179+
}
180+
return true;
181+
}
182+
return false;
183+
}
184+
185+
Ballots &operator=(const Ballots &other) {
186+
assert((subgroupCount() == other.subgroupCount()));
187+
const uint32_t gg = subgroupCount();
188+
for (uint32_t g = 0u; g < gg; ++g)
189+
at(g) = other.at(g);
190+
return *this;
191+
}
192+
193+
Ballots &operator=(const value_type &forAllGroups) {
194+
assert(super::size() >= 1u);
195+
const uint32_t gg = subgroupCount();
196+
for (uint32_t g = 0u; g < gg; ++g)
197+
at(g) = forAllGroups;
198+
return *this;
199+
}
200+
};
201+
} // namespace reconvergence
202+
203+
#endif // EXPERIMENTAL_USERS_CLUCIE_BALLOTS_H_
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
3+
project(maximal_reconvergence_test_generator)
4+
5+
set(CMAKE_CXX_STANDARD 17)
6+
7+
add_executable(generate_reconvergence_test main.cc GenerateReconvergenceTest.cc GenerateReconvergenceTest.h Ballot.h Ballots.h MaskUtils.h Op.h TestCase.h RandomProgram.h RandomUtils.h RandomUtils.cc VectorUtils.h MathUtils.h)
8+
9+
add_custom_target(run ALL
10+
COMMAND generate_reconvergence_test
11+
DEPENDS generate_reconvergence_test)

0 commit comments

Comments
 (0)