-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Improve performance when compiling small shaders. #6396
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
String slice; | ||
HashCode64 hashCode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably we should make the members private.
Not sure if we want to make them const
as well since it is Immutable.
[require(glsl)] | ||
__specialized_for_target(glsl) | ||
[[vk::spirv_instruction(1, "NonSemantic.DebugBreak")]] | ||
void __glslDebugBreak(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should move this to glsl.meta.slang?
source/slang/slang-ir-link.cpp
Outdated
IRBuilder builderStorage; | ||
|
||
// The "global" specialization environment. | ||
IRSpecEnv globalEnv; | ||
}; | ||
|
||
void insertGlobalValueSymbol(IRSharedSpecContext* sharedContext, IRInst* gv); | ||
|
||
struct WitnessTableCloenInfo : RefObject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot found typo here.
WitnessTableCloenInfo -> WitnessTableCloneInfo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, how did you setup copilot to do the review?
Yong He seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Addresses #6358.
This PR address three performance issues when compiling small shaders:
These three optimizations combined achieves a 75% reduction in the benchmark provided in #6358.
Copilot summary:
This pull request includes several changes aimed at improving the handling of GLSL modules, enhancing the differentiation capabilities, and optimizing the IR linking process. The most important changes are grouped by their themes below:
GLSL Module Handling:
SemanticsVisitor::importModuleIntoScope
method to set theglslModuleDecl
when the module name is "glsl".OperatorOverloadCacheKey
to include anisGLSLMode
flag and adjusted its hash code calculation accordingly.ResolveInvoke
to set theisGLSLMode
flag based on the presence of the GLSL module and cache the resolved operator overloads conditionally. [1] [2]Differentiation Enhancements:
IDifferentiable
interface with theKnownBuiltin("IDifferentiable")
attribute.NullDifferential
struct to remove theexport
keyword.IDifferentiable
interface to useIRKnownBuiltinDecoration
instead ofIRNameHintDecoration
.IR Linking Optimization:
ImmutableHashedString
class for efficient string handling in the IR linking process.IRSharedSpecContext::SymbolDictionary
to useImmutableHashedString
and added a new dictionary for imported symbols. [1] [2]Type Checking Cache:
TypeCheckingCache
to inherit fromRefObject
and updated its usage inLinkage
andSession
classes. [1] [2] [3]Debugging and Specialized Targets:
__specialized_for_target(glsl)
attribute and corresponding SPIR-V instruction.These changes collectively improve the handling of GLSL modules, enhance differentiation capabilities, and optimize the IR linking process, making the codebase more efficient and maintainable.