Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve compile time performance. #3857

Merged
merged 15 commits into from
May 30, 2024
Merged

Conversation

csyonghe
Copy link
Collaborator

@csyonghe csyonghe commented Mar 29, 2024

  1. Add caching for implicit conversion overload resolution results.
  2. Handle invalidation of type checking cache upon extension registration more gracefully.
  3. Add a setting to simplifyIR to disable redundancyRemoval pass (still enabled by default).

@csyonghe csyonghe changed the title Handle type check cache update on extensions more gracefully. Improve compile time performance. Mar 30, 2024
Comment on lines +1 to +3
// interface-extension.slang

// Test that an `extension` applied to an interface type works as users expect
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These comments are little confusing.
I assume that they are copied from another file?
If yes, you may need to modify these.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks!

source/slang/slang-check-impl.h Show resolved Hide resolved
jkwak-work
jkwak-work previously approved these changes Apr 2, 2024
Copy link
Collaborator

@jkwak-work jkwak-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@jkwak-work
Copy link
Collaborator

I have some timing numbers here.

Without this change, slangc takes 47.19s ~ 48.18s for compiling 40 TSR shaders.
With this change, slangc takes slightly less time, 46.19s ~ 47.71s for the same TSR shaders.

Without this change, FXC took 90.28s ~ 91.69s for compiling 6 TSR shaders.
With this change, FXC took little longer, 94.42s ~ 95.10s for the same TSR shaders.

I noticed that with this changes, the number of HLSL lines generated from Slangc is about 3% less.
I am not sure if it is expected.

@csyonghe
Copy link
Collaborator Author

csyonghe commented Apr 2, 2024

What about the perf numbers from dxc, and does shader perf change?

@jkwak-work
Copy link
Collaborator

I am sorry. I thought I was using FXC but it was DXC.
All of the data I shared here are based on DXC.

jkwak-work
jkwak-work previously approved these changes Apr 2, 2024
Copy link
Collaborator

@jkwak-work jkwak-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good

@csyonghe
Copy link
Collaborator Author

csyonghe commented Apr 2, 2024

Given your measurements, I am not sure if we should be merging these changes, since it doesn't seem to be a net win.

@csyonghe csyonghe added the pr: non-breaking PRs without breaking changes label May 29, 2024
@csyonghe
Copy link
Collaborator Author

Update: the changes here resulted 20% speedup in frontend when processing typical shader workloads, so I am going to merge it.

jkwak-work
jkwak-work previously approved these changes May 29, 2024
source/slang/hlsl.meta.slang Show resolved Hide resolved
@csyonghe csyonghe merged commit efdbb95 into shader-slang:master May 30, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: non-breaking PRs without breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants