Skip to content

Commit 7947117

Browse files
authored
Merge branch 'master' into rename-libslang
2 parents d8dfde4 + 673af6b commit 7947117

9 files changed

Lines changed: 239 additions & 16 deletions

.github/workflows/ci-slang-coverage.yml

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,56 @@ jobs:
171171
fi
172172
fi
173173
174-
- name: Deploy Coverage to GitHub Pages
174+
- name: Checkout Coverage Reports Repository
175175
if: ${{ inputs.deploy-pages }}
176-
uses: peaceiris/actions-gh-pages@v4
176+
uses: actions/checkout@v4
177177
with:
178-
github_token: ${{ secrets.GITHUB_TOKEN }}
179-
publish_dir: ./coverage-html
180-
destination_dir: coverage
181-
commit_message: "Update coverage report"
178+
repository: "shader-slang/slang-coverage-reports"
179+
path: "coverage-repo"
180+
token: ${{ secrets.SLANG_COVERAGE_REPORTS_PAT }}
181+
182+
- name: Deploy Coverage to Separate Repository
183+
if: ${{ inputs.deploy-pages }}
184+
run: |
185+
# Get current date and short commit hash
186+
REPORT_DATE=$(date -u +"%Y-%m-%d")
187+
COMMIT_SHORT=$(git rev-parse --short HEAD)
188+
FULL_COMMIT=$(git rev-parse HEAD)
189+
REPORT_DIR="reports/history/${REPORT_DATE}-${COMMIT_SHORT}"
190+
191+
cd coverage-repo
192+
193+
# Configure git
194+
git config user.name "github-actions[bot]"
195+
git config user.email "github-actions[bot]@users.noreply.github.com"
196+
197+
# Create directory structure
198+
mkdir -p "${REPORT_DIR}"
199+
mkdir -p reports/latest
200+
201+
# Copy coverage HTML to historical location
202+
cp -r ../coverage-html/* "${REPORT_DIR}/"
203+
204+
# Update latest (replace entire directory)
205+
rm -rf reports/latest/*
206+
cp -r ../coverage-html/* reports/latest/
207+
208+
# Create helper script to generate historical index
209+
bash ../tools/coverage/generate-history-index.sh reports/history
210+
211+
# Commit and push if there are changes
212+
git add reports/
213+
if ! git diff --cached --quiet; then
214+
TIMESTAMP=$(date -u +"%Y-%m-%d %H:%M:%S UTC")
215+
git commit -m "Add coverage report for ${REPORT_DATE} (${COMMIT_SHORT})" \
216+
-m "Generated from shader-slang/slang@${FULL_COMMIT}" \
217+
-m "Date: ${TIMESTAMP}"
218+
219+
git push origin main
220+
echo "Coverage report deployed successfully"
221+
else
222+
echo "No changes to coverage report"
223+
fi
182224
183225
- name: Report Coverage in PR
184226
if: ${{ inputs.pr-comment }}

.github/workflows/coverage-nightly.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
permissions:
14-
contents: write
15-
pages: write
16-
id-token: write
17-
pull-requests: write
14+
contents: read # Read slang repo
15+
pull-requests: write # For PR comments (if needed)
16+
# Note: GITHUB_TOKEN automatically has write access to other org repos
1817

1918
jobs:
2019
coverage:
@@ -27,3 +26,4 @@ jobs:
2726
runs-on: '["ubuntu-22.04"]'
2827
build-llvm: true
2928
deploy-pages: true
29+
secrets: inherit

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- {
2929
os: linux,
3030
platform: aarch64,
31-
runs-on: ubuntu-24.04-arm,
31+
runs-on: ubuntu-22.04-arm,
3232
compiler: gcc,
3333
}
3434
- {

source/slang/slang-emit.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,12 @@ Result linkAndOptimizeIR(
12261226
//
12271227
if (fastIRSimplificationOptions.minimalOptimization)
12281228
{
1229+
// Since we force-inlined functions, we need to clean up
1230+
// dead-branches that may have been revealed due to operations
1231+
// like inlining allowing us to find dead branches.
1232+
// These must be cleaned since otherwise static_assert's will falsely
1233+
// detect true due to dead branches with static_assert not being removed.
1234+
applySparseConditionalConstantPropagation(irModule, sink);
12291235
eliminateDeadCode(irModule, deadCodeEliminationOptions);
12301236
}
12311237
else

tests/bugs/obfuscate-specialization-naming.slang

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ int doThing(RWStructuredBuffer<int> buf, int index)
1414
return buf[index];
1515
}
1616

17-
[numthreads(16, 1, 1)]
17+
[numthreads(4, 1, 1)]
1818
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
1919
{
2020
int tid = int(dispatchThreadID.x);
2121

2222
output[tid] = doThing(a, tid) | doThing(b, tid);
23-
}
23+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry computeMain -DIF
2+
//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry computeMain -minimum-slang-optimization -DIF
3+
//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry computeMain -DSWITCH
4+
//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry computeMain -minimum-slang-optimization -DSWITCH
5+
6+
// CHECK: OpEntryPoint
7+
// CHECK-NOT: error
8+
9+
// Resolution of `constantParamFunc` requires clean up of dead-branches,
10+
// otherwise `static_assert` will incorrectly throw.
11+
12+
int constantParamFunc(constexpr int val)
13+
{
14+
#if defined(IF)
15+
if (val == 0)
16+
{
17+
static_assert(false, "fails here because of a bug");
18+
return 0;
19+
}
20+
#elif defined(SWITCH)
21+
switch (val)
22+
{
23+
case 1:
24+
return 1;
25+
default:
26+
static_assert(false, "fails here because of a bug");
27+
return 0;
28+
}
29+
#endif
30+
return 0;
31+
}
32+
33+
[numthreads(1,1,1)]
34+
void computeMain()
35+
{
36+
constantParamFunc(1);
37+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry computeMain -minimum-slang-optimization
2+
3+
// CHECK: OpEntryPoint
4+
// CHECK-NOT: error
5+
6+
// Resolution of `defaultGetDescriptorFromHandle` requires clean up of dead-branches,
7+
// otherwise `static_assert` will incorrectly throw.
8+
9+
[vk::push_constant]
10+
cbuffer _PC
11+
{
12+
RaytracingAccelerationStructure.Handle TEST_BVH;
13+
};
14+
15+
[numthreads(1,1,1)]
16+
void computeMain()
17+
{
18+
typedef float3 vec3;
19+
typedef float2 vec2;
20+
vec2 uvn = vec2(0);
21+
22+
float t = 0.;
23+
24+
RayDesc ray;
25+
ray.Origin = vec3(0,0,0);
26+
ray.TMin = 0.01f;
27+
ray.Direction = vec3(0,0,1);
28+
ray.TMax = 1e4f;
29+
30+
RayQuery<RAY_FLAG_SKIP_PROCEDURAL_PRIMITIVES |
31+
RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH> q;
32+
33+
uint rayFlags = RAY_FLAG_SKIP_PROCEDURAL_PRIMITIVES |
34+
RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH;
35+
36+
q.TraceRayInline( TEST_BVH, rayFlags, 0xff, ray );
37+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#!/usr/bin/env bash
2+
# Generate historical coverage index HTML
3+
4+
set -e
5+
6+
HISTORY_DIR="$1"
7+
8+
if [[ -z "$HISTORY_DIR" ]]; then
9+
echo "Usage: $0 <history-directory>"
10+
exit 1
11+
fi
12+
13+
# Generate HTML header
14+
cat >"${HISTORY_DIR}/index.html" <<'EOF'
15+
<!DOCTYPE html>
16+
<html>
17+
<head>
18+
<title>Historical Coverage Reports - Slang</title>
19+
<meta charset="UTF-8">
20+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
21+
<style>
22+
body {
23+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
24+
max-width: 1000px;
25+
margin: 50px auto;
26+
padding: 20px;
27+
line-height: 1.6;
28+
color: #333;
29+
}
30+
h1 {
31+
color: #2c3e50;
32+
border-bottom: 3px solid #3498db;
33+
padding-bottom: 10px;
34+
}
35+
.nav {
36+
margin: 20px 0;
37+
}
38+
.nav a {
39+
color: #3498db;
40+
text-decoration: none;
41+
font-weight: 500;
42+
}
43+
.nav a:hover {
44+
text-decoration: underline;
45+
}
46+
table {
47+
width: 100%;
48+
border-collapse: collapse;
49+
margin: 30px 0;
50+
background: white;
51+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
52+
}
53+
th, td {
54+
padding: 15px;
55+
text-align: left;
56+
border-bottom: 1px solid #ddd;
57+
}
58+
th {
59+
background-color: #34495e;
60+
color: white;
61+
font-weight: 600;
62+
}
63+
tr:hover {
64+
background-color: #f5f5f5;
65+
}
66+
a {
67+
color: #3498db;
68+
text-decoration: none;
69+
}
70+
a:hover {
71+
text-decoration: underline;
72+
}
73+
</style>
74+
</head>
75+
<body>
76+
<h1>📊 Historical Coverage Reports</h1>
77+
78+
<div class="nav">
79+
<a href="../../index.html">← Back to Home</a> |
80+
<a href="../latest/index.html">View Latest Report</a>
81+
</div>
82+
83+
<table>
84+
<tr><th>Date</th><th>Commit</th><th>Report</th></tr>
85+
EOF
86+
87+
# List all reports in reverse chronological order
88+
for dir in $(ls -r "${HISTORY_DIR}/" | grep -E '^[0-9]{4}-[0-9]{2}-[0-9]{2}-[a-f0-9]+$'); do
89+
date_part=$(echo $dir | cut -d'-' -f1-3)
90+
commit_part=$(echo $dir | cut -d'-' -f4)
91+
echo " <tr><td>$date_part</td><td><a href=\"https://github.com/shader-slang/slang/commit/$commit_part\">$commit_part</a></td><td><a href=\"$dir/index.html\">View Report</a></td></tr>" >>"${HISTORY_DIR}/index.html"
92+
done
93+
94+
# Generate HTML footer
95+
cat >>"${HISTORY_DIR}/index.html" <<'EOF'
96+
</table>
97+
</body>
98+
</html>
99+
EOF
100+
101+
echo "Generated historical index with $(ls -1 "${HISTORY_DIR}/" | grep -cE '^[0-9]{4}-[0-9]{2}-[0-9]{2}-[a-f0-9]+$') reports"

tools/render-test/render-test-main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ Result RenderTestApp::update()
11121112
auto passEncoder = encoder->beginComputePass();
11131113
auto rootObject =
11141114
passEncoder->bindPipeline(static_cast<IComputePipeline*>(m_pipeline.get()));
1115-
applyBinding(rootObject);
1115+
SLANG_RETURN_ON_FAIL(applyBinding(rootObject));
11161116
passEncoder->dispatchCompute(
11171117
m_options.computeDispatchSize[0],
11181118
m_options.computeDispatchSize[1],
@@ -1125,7 +1125,7 @@ Result RenderTestApp::update()
11251125
auto rootObject = passEncoder->bindPipeline(
11261126
static_cast<IRayTracingPipeline*>(m_pipeline.get()),
11271127
m_shaderTable);
1128-
applyBinding(rootObject);
1128+
SLANG_RETURN_ON_FAIL(applyBinding(rootObject));
11291129
passEncoder->dispatchRays(
11301130
0,
11311131
m_options.computeDispatchSize[0],
@@ -1151,7 +1151,7 @@ Result RenderTestApp::update()
11511151
auto passEncoder = encoder->beginRenderPass(renderPass);
11521152
auto rootObject =
11531153
passEncoder->bindPipeline(static_cast<IRenderPipeline*>(m_pipeline.get()));
1154-
applyBinding(rootObject);
1154+
SLANG_RETURN_ON_FAIL(applyBinding(rootObject));
11551155
setProjectionMatrix(rootObject);
11561156

11571157
RenderState state;

0 commit comments

Comments
 (0)