Page MenuHome

Cycles: Use pre-compiled PTX kernel for older generation when matching one is not found
ClosedPublic

Authored by Patrick Mours (pmoursnv) on Jul 17 2020, 2:46 PM.

Details

Summary

Whenever a new GPU generation comes out, Blender always needed an update to ship new pre-compiled binary kernels for that generation. That has some drawbacks, including e.g. that older Blender versions won't work on those GPUs (unless adaptive compilation is used, but that's really for advanced users).

This patch changes the discovery of pre-compiled kernels, to look for any PTX kernels, even if they don't match the current architecture version exactly. This works because the driver can JIT-compile PTX generated for any architecture less or equal to the current one. For this to be effective the buildbot would ideally not only build CUBINs for the various architectures like it does now, but also include PTX builds as a fallback (at least one, e.g. "compute_75" to e.g. allow Ampere to work, without the explicit need to introduce the CUDA 11 toolkit into the build pipeline yet). Haven't included that change yet, since I wanted to discuss first.

I think this brings the best of both worlds together: CUBIN for fast load times on selected architectures and PTX for compatibility on all others.

Also bumped up the target architecture for the OptiX kernel as discussed in D8063.

Diff Detail

Repository
rB Blender
Branch
cycles_ptx_jit (branched from master)
Build Status
Buildable 9072
Build 9072: arc lint + arc unit

Event Timeline

Patrick Mours (pmoursnv) requested review of this revision.Jul 17 2020, 2:46 PM
Patrick Mours (pmoursnv) created this revision.

I'm fine with this mechanism. For file size reasons, we should only include PTX for the latest one I think.

Is it sufficient to add compute_75 to the CYCLES_CUDA_BINARIES_ARCH list in build_files/cmake/config/blender_release.cmake or does the buildbot use a different config?

That's the config the buildbot uses. Also add it to CYCLES_CUDA_BINARIES_ARCH in the top level CMakeLists.txt.

  • Added "compute_75" kernel target to build configuration
  • Fixed PTX discovery affecting architecture version used by adaptive kernel compilation
This revision is now accepted and ready to land.Jul 20 2020, 6:39 PM