software-mansion / software-mansion/TypeGPU
fix: Raw code snippet block pruning in unroll
Open
Beginner friendly
Nobody has claimed this yet.
bug
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 122
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 34
Description
it('does not break with raw code snippets', () => {
const snip = tgpu['~unstable'].rawCodeSnippet('const a = 1', d.Void);
const fn = () => {
'use gpu';
for (const a of tgpu.unroll([1, 2, 3])) {
snip.$;
}
};
expect(tgpu.resolve([fn])).toMatchInlineSnapshot(`
"fn fn_1() {
// unrolled iteration #0
const a = 1;
// unrolled iteration #1
const a = 1;
// unrolled iteration #2
const a = 1;
// ---
}"
`);
});
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the regression test shown in the issue and trace the tgpu.unroll, rawCodeSnippet, and tgpu.resolve entry points. Reproduce the snapshot output, then inspect how raw snippets are handled during unrolled iteration. Done means the snippet remains present once per iteration and the inline snapshot passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100