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

Low level optimization for GPU? #2395

Open
maajor opened this issue Jun 2, 2021 · 1 comment
Open

Low level optimization for GPU? #2395

maajor opened this issue Jun 2, 2021 · 1 comment
Labels
advanced optimization The issue or bug is related to advanced optimization discussion Welcome discussion! feature request Suggest an idea on this project

Comments

@maajor
Copy link
Contributor

maajor commented Jun 2, 2021

Concisely describe the proposed feature
Low level optimization to utilize hardware's instructions like mad, rcp, log2, exp2 which are only one-cycle, as well as use scalar instead of vector etc.

for example write (x + 3.0f) * 1.5f gives two instruction (add and mul) but x * 1.5f + 4.5f give one instruction (mad)

Although it highly depends on hardware, mostly it's beneficial to use mad style instruction on GPU.
Doing so, according to report[1], could have ~7% performance improvement on shaders.

However, traditionally it was graphic programmers do the job manually, as report[1] claims "Compiler can't change operation semantics so it cant optimize for you". If compiler can do such kind of optimization, it will also save programmer's time.

Describe the solution you'd like (if any)
I see two ways,
a. Add those operators into IR, and use some algorithm optimize semantic
b. Generate optimized code through backend codegen.

For a, I am not a little bit familiar with compiler so no suggestion I can give. For b, I doubt the viability as it's build from IR.

Additional comments
References:
[1] Low-Level Shader Optimization for Next-Gen and DX11, GDC2014, slides
[2] Low-Level GLSL Optimisation for PowerVR

@maajor maajor added the feature request Suggest an idea on this project label Jun 2, 2021
@k-ye k-ye added advanced optimization The issue or bug is related to advanced optimization discussion Welcome discussion! labels Jun 2, 2021
@k-ye k-ye mentioned this issue Jun 3, 2021
43 tasks
@chenzhekl
Copy link

It seems that there is log2 in Taichi. Can we add exp2 into the standard library, too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
advanced optimization The issue or bug is related to advanced optimization discussion Welcome discussion! feature request Suggest an idea on this project
Projects
None yet
Development

No branches or pull requests

3 participants