aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
diff options
context:
space:
mode:
authorLei Zhang <antiagainst@google.com>2019-08-20 13:33:41 -0700
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-08-20 13:34:13 -0700
commitf4934bcc3e38812051f37a1aadbc4d20913ebadc (patch)
tree9a710091fe78b44983bd446c823af3c98a5726c8 /mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
parent82cf6051ee7157a2883210baab191345cbd075bc (diff)
downloadllvm-f4934bcc3e38812051f37a1aadbc4d20913ebadc.zip
llvm-f4934bcc3e38812051f37a1aadbc4d20913ebadc.tar.gz
llvm-f4934bcc3e38812051f37a1aadbc4d20913ebadc.tar.bz2
Add spv.specConstant and spv._reference_of
Similar to global variables, specialization constants also live in the module scope and can be referenced by instructions in functions in native SPIR-V. A direct modelling would be to allow functions in the SPIR-V dialect to implicit capture, but it means we are losing the ability to write passes for Functions. While in SPIR-V normally we want to process the module as a whole, it's not common to see multiple functions get used so we'd like to leave the door open for those cases. Therefore, similar to global variables, we introduce spv.specConstant to model three SPIR-V instructions: OpSpecConstantTrue, OpSpecConstantFalse, and OpSpecConstant. They do not return SSA value results; instead they have symbols and can only be referenced by the symbols. To use it in a function, we need to have another op spv._reference_of to turn the symbol into an SSA value. This breaks the tie and makes functions still explicit capture. Previously specialization constants were handled similarly as normal constants. That is incorrect given that specialization constant actually acts more like variable (without need to load and store). E.g., they cannot be de-duplicated like normal constants. This CL also refines various documents and comments. PiperOrigin-RevId: 264455172
Diffstat (limited to 'mlir/lib/Transforms/LoopInvariantCodeMotion.cpp')
0 files changed, 0 insertions, 0 deletions