About side effect


#1

We have TVM_DLL bool HasSideEffect(const Expr& e) in ir_pass.h

In its implementation, it only checks if there’s a non-pure Call op exist in the Expr

My question is, is that the only case of side effect?

I think Load may introduce side effect, which may cause some memory access error.


#2

In general we do not treat load as having side-effect as loading from the same memory multiple times wont change the value being read.

In the hw implementation, it might cause changes to cache line etc, but such effect do not have things to do with the correctness of the program.