[mlir][tosa] Remove 'Pure' trait from operations that are not speculatable (#185700) This commit removes the 'Pure' trait from a number of TOSA operations. Instead of marking most ops as pure by default, the trait is now opt-in for operations that are provably side-effect free and speculatable. Several operations were previously marked as pure unintentionally. The following operations have had 'Pure' removed (reason in brackets): - ARGMAX (out-of-range index) - AVG_POOL2D (accumulator overflow/underflow) - AVG_POOL2D_ADAPTIVE (same as above) - CONV2D (accumulator overflow/underflow) - CONV2D_BLOCK_SCALED (accumulator overflow/underflow) - CONV3D (accumulator overflow/underflow) - DEPTHWISE_CONV2D (accumulator overflow/underflow) - MATMUL (accumulator overflow/underflow) - MATMUL_T_BLOCK_SCALED (accumulator overflow/underflow) - TRANSPOSE_CONV2D (accumulator overflow/underflow) - ADD (overflow) - SUB (underflow) - MUL (invalid shift, overflow) - ARITHMETIC_RIGHT_SHIFT (invalid shift value) - LOGICAL_LEFT_SHIFT (invalid shift value) - LOGICAL_RIGHT_SHIFT (invalid shift value) - INTDIV (division by zero) - POW (negative exponent restrictions) - TABLE (invalid slope computation) - ABS (underflow) - NEGATE (overflow/underflow) - REDUCE_PRODUCT (overflow) - REDUCE_SUM (overflow) - GATHER (out-of-range indices) - SCATTER (out-of-range or duplicate indices) - RESCALE (overflow/underflow) Many of these operations can exhibit undefined behaviour when a `REQUIRE` condition in the TOSA specification pseudocode fails. Whether such failures result in a runtime error is implementation-defined. As a result, speculating or reordering these operations can change program behaviour. For this reason, the `AlwaysSpeculatable` property implied by `Pure` is not valid for these ops. The `NoMemoryEffect` trait is retained, as these operations do not have direct memory side effects.
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.