Comments (2)
Correct, generally all of the objects we provide aren't thread-safe. They're also not re-entrant except for AddRef/Release (that is, if you implement an include handler for example, you can't call back into the compiler). They also don't have thread affinity (that is, you can make a call on one thread, then make a call on a different thread, as long as the calls aren't concurrent). Note that creating compiler instances is pretty cheap, so it's probably not worth the hassle of caching / sharing them.
However, please leave this issue open for a bit - this particular problem does show a race that we haven't seen before. For posterity, here's an explanation of this (this really should become a Wiki topic or blog post at some point).
LLVM has a notion of a registry pass, where pass metadata is available. Some functions do take the registry pass as an input, but there are many places where the reference is always obtained from a global singleton, so in practice the registry pass ends up being global.
The problem is that many passes will register on-demand, like in the stack you see above, which can lead to complications with correctness/completeness (enumerating passes results in incomplete / changing information) or with failure points (code doesn't expect to deal with registration errors when creating passes). Our solution is to register all the passes at DLL load time, and then the registry acts as a frozen, read-only object during the life of the library.
Long story short: if we're registering during compilation, it's too late and we forgot to register a pass at DLL load time.
from directxshadercompiler.
Thanks for info! I'll add some critical sections to my code.
from directxshadercompiler.
Related Issues (20)
- [SPIR-V] Dxc crashes when compiling erroneous code HOT 2
- [SPIR-V] Invalid use of a combined image sampler fails at legalization
- [ExecutionTest] WaveRangeSize is missing HLK tests
- DXC emits racey zero-init code when numthreads(1,1,1) HOT 3
- Several verifier test checks not being run in HLSLFileCheck folder HOT 2
- Uninitialized resource didn't get compile error
- [SPIR-V] Verify behavior of `HitAttributeNV` vars
- FileCheckerTest incorrectly skips validator version check when -Vd specified
- assert/crash on min16int raw buffer templated Store
- TimeTraceProfiler is missing the configurable setting for TimeTraceGranularity
- [Feature Request] Release binary built with clang-cl
- dxc.exe works in cmd but not works in Windows PowerShell HOT 2
- [SPIR-V] GetAttributeAtVertex(0,0) fails validation HOT 2
- [SPIR-V] Verify behavior of GetAttributeAtVertex HOT 4
- [SPIR-V] GetAttributeAtVertex on struct member without nointerpolation fails validation HOT 2
- CSE doesn't work properly in some case, producing suboptimal code
- Move Patch constant `inout` parameter check to Sema
- [SPIR-V] Move check to verify PatchConstant output patch element count to Sema
- [Validation] Wave size range tests do not have coverage for when the minimum and maximum are equal
- static variable inside cbuffer are not marked const HOT 4
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 directxshadercompiler.