Comments (12)
I couldn't figure this one out why it is causing a problem.
I will need to figure out how to debug Falcor unit tests locally.
When I attempted, falcore.sln failed to open with my VisualStudio 2022.
Since this is a low priority clean up task, I am filing an issue and moving on to a higher priority task for now.
from slang.
I noticed that the falcor code is calling min
from a static const
:
struct LeapedHaltonSampleGenerator : ISampleGenerator
{
struct Padded
{
LeapedHaltonSampleGenerator internal;
uint2 _pad;
};
static const uint kDimensionCount = LeapedHaltonSequence::kDimensionCount;
static const uint kInstanceCount = min(4096, LeapedHaltonSequence::kInstanceCount); //
...
Is there a way we can reproduce this with a similar test case?
from slang.
I noticed that the falcor code is calling
min
from astatic const
:struct LeapedHaltonSampleGenerator : ISampleGenerator { struct Padded { LeapedHaltonSampleGenerator internal; uint2 _pad; }; static const uint kDimensionCount = LeapedHaltonSequence::kDimensionCount; static const uint kInstanceCount = min(4096, LeapedHaltonSequence::kInstanceCount); // ...
Is there a way we can reproduce this with a similar test case?
Interesting... I will test it with slang-test.
from slang.
I am not sure if I did it correctly.
But when I tried, the result was folded and there was no SMin/UMin instruction emitted.
I had a code like this,
enum TEST : int
{
kConst = 1997
};
static int JKWAK = min(1996, int(TEST::kConst));
The emitted SPIR-V was like this,
%int_1996 = OpConstant %int 1996
OpStore %JKWAK %int_1996
from slang.
What is kConst
is uint
? Have you tried -O0
? But the high level bit here is that things are compiling just fine.
from slang.
When I tried uint
, I found a bug that it is treated as int
.
But I don't think this is related to problem I was having, because it still doesn't emit UMin/SMin.
enum TEST : uint
{
kConst = (1 << 31)
};
static uint JKWAK = min(4096, uint(TEST::kConst));
The code above yields the following,
%uint_2147483648 = OpConstant %uint 2147483648
OpStore %JKWAK %uint_2147483648
When I tried "(1 << 30)", it worked correctly but not for "(1 << 31).
The option -O0
hasn't shown any differences but I will keep playing with it.
from slang.
I will create a new issue for the problem with min.
from slang.
This is not a problem with min, but with overload resolution.
We should make conversion of an int literal to some other int type within range bearing a smaller cost so we can pick up min(uint,uint) when calling min(4096, uint(x)).
from slang.
I was able to build FalcorTest.exe locally.
On my previous attempt, the testing was done with an old binary that I built a few month ago.
With the latest binaries, I can reproduce the issue only with Release build not Debug build.
from slang.
The problem here is if the user writes:
static const uint val = min(4096, uint(0xFFFFFFFF));
What should we resolve?
If we resolve to min(int,int)
, then val
will be 0xFFFFFFFF
.
If we resolve to min(uint,uint)
, then val
will be 4096.
from slang.
In this particular case, we shouldn't be resolving into min(int,int)
because we know that 0xFFFFFFFF is out of range of int
, but 4096
is within the range of uint
, so we should prefer converting 4096 to uint and call min(uint, uint)
.
from slang.
This issue is blocked by another issue, #4104
from slang.
Related Issues (20)
- Metal: Opaque type return/inout-param/out-param either infinitely-loops or crashes
- Metal: atomic instructions for buffers HOT 1
- Add Tint as a downstream compiler
- Add WGSL as an output target
- Extraneous type conformances causes compiler error.
- Metal: Slang does not legalize `[[color(n)]]`/`[[attribute(n)]]` attributes correctly HOT 4
- tests/cpu-program/gfx-smoke.slang fails on local test HOT 2
- Add Support for Sparse/Tiled Texture Operations (HLSL, GLSL, SPIRV)
- `Texture2DMS` and `Texture2DMSArray` missing `sample` operator HOT 1
- Metal: Investigate why `slang-test` fails with valid shaders targeting Metal backend HOT 2
- Drop premake
- GLSL to Slang Questions HOT 1
- Capability System: `[require(....)]` never checks if the capabilities required are invalid
- Capability System: `__target_switch` never compares `case:` capabilities to the parent `[require(...)]`
- Document proposal process clearly
- Triage and update status of existing proposal documents
- Capability system causes issues with `__dispatch_kernel()` for slang-torch use-cases
- this issue can be deleted HOT 1
- Capture/Replay: Implement decoder
- Capture/Replay: Implement consumer
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slang.