Documentation
¶
Overview ¶
Package cudas2r provides a telemetry oracle for NVIDIA SASS special registers (SR 0..255) accessible via S2R, CS2R, and S2UR instructions on sm_121a (GB10).
Special registers expose hardware state, timers, thread/block identifiers, performance counters, memory bounds, and fault status. This package audits the mapping from PTX special registers to SASS SR indices and classifies each index according to measured hardware readability, hardware pending status, or hardware refusal under gpu-lock on GB10.
This package is outside the compatibility promise of github.com/tmc/lib/nvidia. Its API may change or be removed in patch releases.
Example ¶
package main
import (
"fmt"
"github.com/tmc/lib/nvidia/x/obs/cudas2r"
)
func main() {
// Look up SR_TID.X in the 256-entry special register table.
desc, ok := cudas2r.LookupByName("SR_TID.X")
if !ok {
panic("SR_TID.X not found")
}
fmt.Printf("%s: index=%d ptx=%s read-only=%v\n", desc.Name, desc.Index, desc.PTXName, desc.ReadOnly)
}
Output: SR_TID.X: index=33 ptx=%tid.x read-only=true
Index ¶
- func AuditPTXSpecialRegisters() map[string]SRDescriptor
- func EncodeCS2R(rd uint8, srIndex uint8, is64 bool, pred string, c sass.ControlCode) (sass.Encoding, error)
- func EncodeS2R(rd uint8, srIndex uint8, pred string, c sass.ControlCode) (sass.Encoding, error)
- func EncodeS2UR(urd uint8, srIndex uint8, pred string, c sass.ControlCode) (sass.Encoding, error)
- func FindNvdisasm() (string, error)
- func VerifyEncodingNvdisasm(enc sass.Encoding) (string, error)
- type SRDescriptor
- type Status
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuditPTXSpecialRegisters ¶
func AuditPTXSpecialRegisters() map[string]SRDescriptor
AuditPTXSpecialRegisters maps all PTX special registers to their SASS SR descriptors.
func EncodeCS2R ¶
func EncodeCS2R(rd uint8, srIndex uint8, is64 bool, pred string, c sass.ControlCode) (sass.Encoding, error)
EncodeCS2R encodes a 128-bit sm_121a CS2R Rd, SR instruction (32-bit or 64-bit pair).
func EncodeS2R ¶
EncodeS2R encodes a 128-bit sm_121a S2R Rd, SR instruction.
Example ¶
package main
import (
"fmt"
"github.com/tmc/lib/nvidia/x/isa/sass"
"github.com/tmc/lib/nvidia/x/obs/cudas2r"
)
func main() {
ctrl := sass.ControlCode{Stall: 2, Yield: true, WriteBarrier: 7, ReadBarrier: 7}
// Encode S2R R0, SR_LANEID (index 0).
enc, err := cudas2r.EncodeS2R(0, 0, "", ctrl)
if err != nil {
panic(err)
}
fmt.Printf("Lo=%#016x selector=%d\n", enc.Lo, (enc.Hi>>8)&0xff)
}
Output: Lo=0x0000000000007919 selector=0
func EncodeS2UR ¶
EncodeS2UR encodes a 128-bit sm_121a S2UR URd, SR instruction.
func FindNvdisasm ¶
FindNvdisasm locates the nvdisasm toolchain executable.
Types ¶
type SRDescriptor ¶
type SRDescriptor struct {
Index uint8
Name string
PTXName string
ReadOnly bool
S2R bool
S2UR bool
CS2R bool
Status Status
Description string
}
SRDescriptor describes one SASS special register index (0..255).
func LookupByIndex ¶
func LookupByIndex(index uint8) SRDescriptor
LookupByIndex returns the descriptor for special register index.
func LookupByName ¶
func LookupByName(name string) (SRDescriptor, bool)
LookupByName returns the descriptor for special register name (SASS or PTX).
func Table ¶
func Table() [256]SRDescriptor
Table returns the complete 256-entry table of sm_121a special registers.
type Status ¶
type Status string
Status represents the qualification status of a special register.
const ( // StatusMeasured indicates the special register has been verified on hardware. StatusMeasured Status = "measured" // StatusUnsupported indicates the hardware or toolchain rejects reading this register. StatusUnsupported Status = "ErrUnsupported" // StatusHardwarePending indicates the register has not yet been probed on this target. StatusHardwarePending Status = "ErrHardwarePending" // StatusUnmeasured indicates the test executed without reading this counter. StatusUnmeasured Status = "Unmeasured" )