XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESystem

【Rust】XFE系统,基于Rust和汇编

公开
关注 0 Fork 0 Star 0
UTF-8
using System.Text.Json;
using XFESystem.Gpu.Nvidia;

if (args.Length != 1) throw new ArgumentException("Pass a private output directory. This probe does not open or execute on a GPU.");
string output = Path.GetFullPath(args[0]);
Directory.CreateDirectory(output);
const ulong target = 0x123456789ABC, fence = 0x0111222233334400, pushbuffer = 0x0123456789ABC000;
const uint color = 0xFFAC99EA, pixels = 2, payload = 0x98765432;
byte[] commands = new byte[NvidiaBlackwellCommands.Fill32CommandBytes];
NvidiaBlackwellCommands.WriteFill32(commands, NvidiaBlackwellCommands.CopyClassB,
    new(target, pixels * 4), pixels, color, new(fence, 4), payload);
byte[] entries = new byte[16];
NvidiaBlackwellCommands.WriteSegmentBase(entries, new(pushbuffer, (ulong)commands.Length));
NvidiaBlackwellCommands.WriteGpfifoEntry(entries.AsSpan(8), new(pushbuffer, (ulong)commands.Length), commands.Length);
File.WriteAllBytes(Path.Combine(output, "Fill32.bin"), commands);
File.WriteAllBytes(Path.Combine(output, "Gpfifo.bin"), entries);
string metadata = JsonSerializer.Serialize(new {
    Schema = "XfeNvidiaProtocolVector1", Scope = "Offline encoding only; no GPU or CUDA executed",
    CopyClass = NvidiaBlackwellCommands.CopyClassB, Target = target, Fence = fence,
    Pushbuffer = pushbuffer, Pixels = pixels, Color = color, Payload = payload,
    CommandBytes = commands.Length, GpfifoBytes = entries.Length
}, new JsonSerializerOptions { WriteIndented = true });
File.WriteAllText(Path.Combine(output, "Vector.json"), metadata);
Console.WriteLine(metadata);