Documentation
¶
Overview ¶
Package cudahazard models GPU memory access hazards across execution scopes and memory spaces without importing higher-level tile or compiler packages.
Index ¶
- func ByteRangeOverlap(aOffset uint64, aSize uint32, bOffset uint64, bSize uint32) bool
- func CheckClusterHardware(arch string) error
- func WordOverlap(aOffset uint64, aSize uint32, bOffset uint64, bSize uint32) bool
- type ExecutionScope
- type HazardMatrix
- type HazardRecord
- type HazardType
- type MemoryAccess
- type MemorySpace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByteRangeOverlap ¶
ByteRangeOverlap reports whether two byte intervals [aOffset, aOffset+aSize) and [bOffset, bOffset+bSize) intersect.
func CheckClusterHardware ¶
CheckClusterHardware checks whether the target architecture supports thread block clusters and DSMEM. Compute capability 9.0+ (sm_90+) is required. For architectures below sm_90 (e.g. sm_80), it returns cuda.ErrHardwarePending rather than simulating device execution.
Types ¶
type ExecutionScope ¶
type ExecutionScope uint8
ExecutionScope identifies the concurrency level at which memory operations interact.
const ( ScopeSubwarp ExecutionScope = iota + 1 ScopeWarp ScopeCTA ScopeCluster ScopeDevice ScopeHostDevice ScopeMultiGPU )
func (ExecutionScope) String ¶
func (s ExecutionScope) String() string
String implements fmt.Stringer.
type HazardMatrix ¶
type HazardMatrix struct {
TargetArch string
ClusterSize int
// contains filtered or unexported fields
}
HazardMatrix tracks concurrent memory operations and classifies hazards across execution scopes.
func NewHazardMatrix ¶
func NewHazardMatrix(targetArch string) *HazardMatrix
NewHazardMatrix initializes a hazard matrix for a given target GPU architecture.
func (*HazardMatrix) AddAccess ¶
func (m *HazardMatrix) AddAccess(acc MemoryAccess) error
AddAccess registers a memory access into the matrix.
func (*HazardMatrix) Evaluate ¶
func (m *HazardMatrix) Evaluate() ([]HazardRecord, error)
Evaluate inspects all pairs of recorded accesses and classifies race conditions versus false positives.
func (*HazardMatrix) HasRace ¶
func (m *HazardMatrix) HasRace() (bool, error)
HasRace reports whether any true data race was identified across all evaluated accesses.
type HazardRecord ¶
type HazardRecord struct {
AccessA MemoryAccess
AccessB MemoryAccess
Type HazardType
WordConflict bool
ByteConflict bool
IsRace bool
ScopeConflict bool
Description string
}
HazardRecord records an evaluated interaction between two concurrent memory accesses.
type HazardType ¶
type HazardType uint8
HazardType classifies memory access conflicts.
const ( HazardNone HazardType = iota HazardReadWrite HazardWriteWrite HazardWriteRead )
type MemoryAccess ¶
type MemoryAccess struct {
Scope ExecutionScope
AgentID int
StreamID int
ThreadID int
BlockID int
ClusterID int
Space MemorySpace
Offset uint64
SizeBytes uint32
IsWrite bool
Stage int
}
MemoryAccess describes an individual read or write access. AgentID distinguishes independent agents such as kernels. For device-scoped accesses from different agents, a shared nonzero StreamID records launch ordering; thread, block and cluster identify execution coordinates within an agent. One agent cannot represent accesses on multiple nonzero streams; accesses with the same agent ID on different nonzero streams are treated as distinct.
type MemorySpace ¶
type MemorySpace uint8
MemorySpace identifies the physical or virtual GPU memory space.
const ( MemoryDSMEM MemoryGlobal MemoryUnified )