Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/omega/slices/mesa.osc # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / omega / slices / mesa.osc` 66 lines · 2087 bytes Raw Blame History 1 // slice-entry: mesa_ctx mesa_entry mesa_token 2 // Our userspace GPU driver, in Omega. This is the job Mesa does for a 3 // compute submit, and none of Mesa is linked. A context is accepted only 4 // when the device exposes Blackwell compute (52928), Blackwell GPFIFO 5 // (51567) and Hopper usermode (50785). A submit is one GP entry, LEVEL_MAIN 6 // clear, plus the doorbell token. A value that does not fit refuses. 7 // Expected GP entry and token from the same Wolfram values as the NVRM slice. 8 // slice-run: mesa_ctx cells:4=3,52928,51567,50785 -> 7 9 // slice-run: mesa_ctx cells:4=2,52928,51567,0 -> `18446744073709551615` 10 // slice-run: mesa_entry bytes: 4096 4 -> `17592186048512` 11 // slice-run: mesa_entry bytes: 4097 4 -> `18446744073709551615` 12 // slice-run: mesa_entry bytes: 0 0 -> `18446744073709551615` 13 // slice-run: mesa_token bytes: 3 42 -> 196650 14 // slice-run: mesa_token bytes: 128 0 -> `18446744073709551615` 15 16 fn mesa_ctx(cls: cells) -> u64 { 17 if cls.len < 1 { 18 return `18446744073709551615`; 19 } 20 let n: u64 = cls[0]; 21 if n > cls.len - 1 { 22 return `18446744073709551615`; 23 } 24 let mut found: u64 = 0; 25 let mut i: u64 = 0; 26 while i < n bound 512 { 27 let id: u64 = cls[1 + i]; 28 if id == 52928 { 29 found = found | 1; 30 } 31 if id == 51567 { 32 found = found | 2; 33 } 34 if id == 50785 { 35 found = found | 4; 36 } 37 i = i + 1; 38 } 39 if found != 7 { 40 return `18446744073709551615`; 41 } 42 return found; 43 } 44 45 fn mesa_entry(b: bytes, va: u64, nwords: u64) -> u64 { 46 if b.len > 0 { 47 return `18446744073709551615`; 48 } 49 if va & 3 != 0 || va >= `1099511627776` { 50 return `18446744073709551615`; 51 } 52 if nwords == 0 || nwords > `2097151` { 53 return `18446744073709551615`; 54 } 55 return va | (nwords << 42); 56 } 57 58 fn mesa_token(b: bytes, runlist: u64, channel: u64) -> u64 { 59 if b.len > 0 { 60 return `18446744073709551615`; 61 } 62 if channel > 4095 || runlist > 127 { 63 return `18446744073709551615`; 64 } 65 return channel | (runlist << 16); 66 }