reprospect.test.sass.matchers.cas module

class reprospect.test.sass.matchers.cas.AtomicCASMatcher(arch: NVIDIAArch, operation: Operation, size: int = 64)View on GitHub

Bases: object

Find two blocks to prove there is an atomic CAS code path.

Typically:

LDG.E.128 R4, desc[UR6][R2.64]
...
IMAD.MOV.U32 R8, RZ, RZ, R4
DADD R14, R6, UR10
IMAD.MOV.U32 R9, RZ, RZ, R5
...
DADD R12, R8, UR8
...
IMAD.MOV.U32 R10, RZ, RZ, R6
IMAD.MOV.U32 R11, RZ, RZ, R7
...
ATOM.E.CAS.128.STRONG.GPU PT, R12, [R2], R8, R12

Since registers from the load instruction may be moved before they are used, this matcher proceeds as follows:

  1. Find the block with a global load, which gives the address register ([R2]).

  2. Find the child block that has an atomic CAS using the same address register as the global load instruction. It gives the register used for the new value (R12).

  3. The operation must be in the same block as the atomic CAS and output in the new value register, possible via moves.

__init__(arch: NVIDIAArch, operation: Operation, size: int = 64) NoneView on GitHub
match(cfg: Graph) list[InstructionMatch] | NoneView on GitHub
operation: Final[Operation]

Operation on the value.

class reprospect.test.sass.matchers.cas.Operation(*args, **kwargs)View on GitHub

Bases: Protocol

__init__(*args, **kwargs)
build() SequenceMatcherView on GitHub