cdl-saarland / rv

RV: A Unified Region Vectorizer for LLVM
Other
102 stars 15 forks source link

Implement atomicrmw CodeGen #49

Closed simoll closed 3 years ago

simoll commented 3 years ago

RV does not support LLVM atomicrmw yet (https://llvm.org/docs/LangRef.html#atomicrmw-instruction). Currently, RV's lane threads aren't considered concurrent threads in terms of the LLVM execution model and so atomicrmw remains scalar.

What needs to change: The result of atomicrmw is always a varying value. Otherwise, this is mostly a RV codegen issue (NatBuilder.cpp).

When the backend vectorizes an atomic instruction, it should apply the operator of the atomic (add, umin, umax, xor, ..) to reduce the value vector into a scalar value and emit just one atomicrmw with the reduced value.

What is tricky about atomicrmw is two things:

simoll commented 3 years ago

Implemented by https://github.com/cdl-saarland/rv/pull/50