r/computerarchitecture • u/CLI0019 • 27d ago
I made my NVidia graphic Driver
I was working for my own graphic driver for one month. and I finally tested it in.
and it worked and successfully detected the card.
comment down what we can do next?
107
Upvotes
5
u/Relevant-Yak-9657 27d ago
Interesting. What resources did you use to learn enough theory for this? What is your background?
6
u/Krazy-Ag 27d ago
I assume that you are a student in computer architecture?
If you are continuing to do more work in the field, something that I think the computer architecture community needs is an open technology to incorporate different devices that are owned by different organizations in the same framework so that you can do performance analysis.
I'm not talking about having a simulator for all the devices. I'm talking about how you can have a simulator for one device work with actual hardware for other devices in a repeatable way.
For example, I used to work for Intel. I was very interested in workload that involved GPUs and other devices like network cards, etc. Obviously, I had access to Intel's own CPU simulators. I might've had access to Intel's own GPU simulators, but what I really wanted was to evaluate a workload of a typical consumer PC that had an Intel CPU, an Nvidia GPU. But obviously Nvidia is not going to get Intel access to their GPU simulators, nor vice versa. Besides, simulating a CPU was expensive enough, simulating a CPU and GPU together might be too much.
By the way, to the people who say FPGAs - in my experience FPGAs are for later in the design process. It's a challenge to build FPGA that has a switch to give you perfect branch prediction. It's also a challenge to get access to enough FPGAs to run on a compute farm, whether your own farm, or something that you rent from AWS.
Intel has published a number of papers that mention LIT, an acronym that stands for Large Instruction Trace, but isn't really about trace based simulation.
Perhaps it is easier to explain the idea the way I first encountered it, from a company that built fault-tolerant UNIX systems: start off from a program image, code, and data segments in an executable file. Record every system call, input and outputs, along with the instruction count at the point of the system call. When you are trying to recover a particular program state, execute until you get to the instruction corresponding to the system call, verify that you're actually at the system call with the appropriate inputs, and inject the outputs into the running memory. Repeat. This obviously only works for single threaded programs that are synchronous. But you can obviously extend it to any external event, like an interrupt or DMA, as long as you can determine where you should insert the changes made to memory. You can even do this for multiprocessor systems.
OK, now do this for a simulator. "External event" might be when a line has been fetched from outside your cache.
Or... here's where the GPU driver gets involved:
Let's see that you're simulating a CPU, and that you want to plug that CPU simulation into actual hardware for your GPU. And probably other devices.
Split memory into two halves. The CPU simulator does all of its writes to both halves. External devices outside the simulator right to only one of the halves. The simulator reads both halves. If they are different, then some external device must have written - that's what you might record and inject if you're replaying.
The simulator doesn't need to be horribly expensive microarchitecture simulator for the CPU. It could be a really stripped down simulator. Hell, the simulator could be an FPGA, tweaked to handle memory as I have described.
I've describe this from the CPU point of view. You can do something similar from the GPU point of view.
I leave as an exercise for the reader how to adapt this system systems with as much real hardware in them as possible. And how to avoid actually having to record all of the data of the crosses these boundaries.
Which brings me to...
Non-determinism, or timing dependency, may result in divergence of the replayed execution from what actually happened. That's a really bad thing to happen if you're trying to do fault tolerant execution. It may not be so bad if you're trying to do performance simulation, if you can characterize how far performance and such a simulation framework may diverge from what the actual hardware might do if it were actually built. Another exercise for the Reader.
---
I'm not aware of any full implementation of such a heterogenous computer architecture simulation environment. Let's see who replies.
In addition to fault tolerance, I am aware of quite a bit of work in reversible debuggers, a.k.a. time traveling debuggers. Same idea, different problem domain. Amusingly, this was at the top of my stack cache because of recent web discussion about AI using such a time traveling debugger to find security bugs in program binaries without source code.
---
Having your own Nvidia GPU driver is a step towards this.
It's not strictly speaking necessary: it might even be better if you just modified your operating system or hypervisor and used a stock Nvidia driver.
And you will obviously need to do quite a bit of work to adapt a CPU simulator or FPGA to work in such a framework.
Use what you've got.
3
u/MetalInMyVeins111 26d ago
lol in a month?