Prefer to keep member functions as member functions #3921
Labels
goal:quality & productivity
Quality issues and issues that impact our productivity coding day to day inside slang
kind:performance
things we wish were faster
Description of the problem
It appears that the compile-time of DXC goes up when a certain condition is met.
It is still unclear what the condition is but we like to avoid any unnecessary extra compile-time if possible.
The observation is that the compile-time goes up when calling global functions, compare to calling member functions.
Since Slang turns most, if not all, member functions into global functions, there is higher chance that we will trigger the issue on DXC side.
Goal
We should prefer to keep member functions as member functions so that we get a better chance of avoiding the DXC performance issue.
Repro-steps
Note that the issue is not 100% reproducible by just calling a global function, although it occurs deterministically once you hit the case.
There must be other conditions required to reproduce the issue.
The current theory is that certain pattern of the shader code triggers an optimization mechanism. And it increases the compile-time unnecessarily.
Here is a simple example that can reproduce the issue.
Assuming that the shader code above is saved as "extra_compile_time.hlsl", it can be compiled in four following ways:
Each command took following amount of time to compile on my machine,
Note that only the 3rd case has increased compile-time while the others show similar and smaller compile-time.
Also note that the generated DXIL binary files are all identical.
You can make the difference more obvious by using a bigger number for SIMD_SIZE.
The text was updated successfully, but these errors were encountered: