Use IDifferentiablePtrType
for function-scope vars that cannot be SSA'd for performance reasons
#5001
Labels
goal:client support
Feature or fix needed for a current slang user.
Milestone
We currently have a special SSA pass that converts all types (arrays, structs, structs of structs, etc..) into SSA types and converts reads and writes into
OpGetElement
/OpUpdateElement
instructions with access-chain information.This was initially done in order to avoid dealing with
OpVar
andOpPtrType
instructions. However, it makes sense to treat these as 'buffer' types (at a function-local level) and treat loads and stores from these as we would from a resource object (turn loads into "store & set-zero" and stores into "atomic accumulates").This avoid some catastrophic situations where aggregate objects that are modified within a loop will cause the entire aggregate to be stored per-iteration (unnecessarily), causing the resulting kernel to be far too slow, or refuse to compile entirely
This issue will be easier to resolve once the
IDifferentiablePtrType
system is implemented (Issue #4998), as we can expressPtrType<T : IDifferentiable>
as anIDifferentiablePtrType
This issue also depends on #4211 (which implements an intermedate
OpAccumulate
inst that stands in for theOpLoad/OpCall("dadd")/OpStore
combo that causes a ton of clutter in our reverse-mode pass)The text was updated successfully, but these errors were encountered: