reprospect.testing.binaries.sass.instruction package
At first glance, examining generated SASS code may appear to be an esoteric task suited only to expert lab researchers — let alone testing it.
Yet, studying SASS — and assembly code in general — offers valuable insights. Indeed, modern HPC code bases rely on complex software stacks and compiler toolchains. While code correctness is often checked through regression testing, reaching and sustaining optimal performance as software and hardware evolve requires additional effort. This is usually achieved through verification of compile flags and ad hoc profiling and benchmarking. However, beyond runtime analysis, the SASS code already contains information about the available code paths and could itself be incorporated into testing. Still, the barrier to entry for meaningful SASS analysis is high: results can vary dramatically with compiler versions, optimization flags, and target architectures.
ReProspect provides a hierarchy of SASS instruction matchers that capture the components of an instruction (opcodes, modifiers and operands). Under the hood, they generate complex regular expression (regex) patterns. To accommodate for the evolving CUDA Instruction Set, some of these matchers take the target architecture as a parameter and adjust the regex patterns accordingly. In this way, ReProspect helps developers write assertions about expected instructions, while reducing the need to track low-level details of the evolving CUDA instruction set.
>>> from reprospect.tools.architecture import NVIDIAArch
>>> from reprospect.testing.binaries.sass.instruction import LoadGlobalMatcher
>>> LoadGlobalMatcher(arch = NVIDIAArch.from_str('VOLTA70')).match(inst = 'LDG.E.SYS R15, [R8+0x10]')
InstructionMatch(opcode='LDG', modifiers=('E', 'SYS'), operands=('R15', '[R8+0x10]'), predicate=None, additional={'address': ['[R8+0x10]']})
>>> LoadGlobalMatcher(arch = NVIDIAArch.from_str('BLACKWELL120'), size = 128, readonly = True).match(inst = 'LDG.E.128.CONSTANT R2, desc[UR15][R6.64+0x12]')
InstructionMatch(opcode='LDG', modifiers=('E', '128', 'CONSTANT'), operands=('R2', 'desc[UR15][R6.64+0x12]'), predicate=None, additional={'address': ['desc[UR15][R6.64+0x12]']})
References:
[YWC20]
Submodules
- reprospect.testing.binaries.sass.instruction.address module
AddressMatcherAddressMatcher.__init__()AddressMatcher.archAddressMatcher.build_desc_reg64_address()AddressMatcher.build_generic_or_global_address()AddressMatcher.build_local_address()AddressMatcher.build_pattern()AddressMatcher.build_pattern_desc_ureg()AddressMatcher.build_pattern_offset()AddressMatcher.build_pattern_reg()AddressMatcher.build_pattern_stride()AddressMatcher.build_reg64_address()AddressMatcher.build_reg_address()AddressMatcher.build_reg_extend_bits_address()AddressMatcher.build_reg_stride_address()AddressMatcher.build_shared_address()AddressMatcher.desc_uregAddressMatcher.match()AddressMatcher.memoryAddressMatcher.offsetAddressMatcher.patternAddressMatcher.regAddressMatcher.stride
GenericOrGlobalAddressMatchLocalAddressMatchMODIFIER_STRIDESharedAddressMatchStrideModifier
- reprospect.testing.binaries.sass.instruction.atomic module
- reprospect.testing.binaries.sass.instruction.branch module
- reprospect.testing.binaries.sass.instruction.constant module
- reprospect.testing.binaries.sass.instruction.floating module
- reprospect.testing.binaries.sass.instruction.half module
- reprospect.testing.binaries.sass.instruction.immediate module
- reprospect.testing.binaries.sass.instruction.instruction module
- reprospect.testing.binaries.sass.instruction.integer module
- reprospect.testing.binaries.sass.instruction.load module
- reprospect.testing.binaries.sass.instruction.memory module
- reprospect.testing.binaries.sass.instruction.operand module
- reprospect.testing.binaries.sass.instruction.pattern module
- reprospect.testing.binaries.sass.instruction.register module
RegisterRegisterMatchRegisterMatcherRegisterMatcher.__init__()RegisterMatcher.build_pattern()RegisterMatcher.build_pattern_modifier_math()RegisterMatcher.build_pattern_modifier_reuse()RegisterMatcher.build_pattern_reg()RegisterMatcher.indexRegisterMatcher.match()RegisterMatcher.mathRegisterMatcher.patternRegisterMatcher.reuseRegisterMatcher.rtypeRegisterMatcher.special
- reprospect.testing.binaries.sass.instruction.store module
- reprospect.testing.binaries.sass.instruction.validate module