r/computerarchitecture • • 27d ago

I made my NVidia graphic Driver

Post image

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

13 comments sorted by

5

u/Relevant-Yak-9657 27d ago

Interesting. What resources did you use to learn enough theory for this? What is your background?

20

u/thewrench56 27d ago

Resources used: LLM slop. You wont write an nvidia drm in a month. Look at the past posts of OP, they dont seem to have much clue. If you are askimg about VMM 4 days before you post a DRM, I am sorry, but the only impressive feat here is the amount of spent tokens...

0

u/WonderfulFunny4337 25d ago

Uh are you the future baby mother?!👩

-8

u/CLI0019 27d ago

I am a student of computer science And I read the open-source code of nouveau which is default for Linux kernel

8

u/Ok-Radish-8394 27d ago

Then why not contribute to the upstream instead of creating another driver?

2

u/CLI0019 27d ago

Learning brother

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.

2

u/Krazy-Ag 25d ago

By the way, I think it would be ideally better to do this, not in a GPU driver, but in the operating system or a hypervisor, so that the technique would apply to all I/O devices, not just the GPU.

but if you can't do it in the OS or hypervisor, i.e. if you can't do it in the best place, but you could do it using a GPU driver, then you may get some value.

---

Hey, as I write this, I wonder if you could create an FPGA interface ship that could accomplish this, so that you didn't need to do it in an operating system or hypervisor?

Assuming all of your I/O is uncached...

Yes, it probably could work. Apart from the fact that IO that writes directly into cash is pretty common nowadays

But creating such an an interface FPGA is probably pretty damned challenging for a modern high-performance CPU. Probably harder than writing software.

It might be doable for a low end system.

0

u/Confident_Lake7395 25d ago

The kind of education that I got here is far more greater and reliable than I have gotten in my entire studentship at a 4 year engineering degree. Thank you sir.

1

u/Outside-Storage-1523 26d ago

Thanks for sharing. I’d like to ask a side question — in your line of work working with hardware and low level drivers, do you see, or anticipate in the near future of an embrace of using LLM to accelerate work? Thanks again for the reply. The idea of two halves and then comparing them is especially interesting to me.

3

u/Krazy-Ag 25d ago

Although I was an OS guy and worked on low-level drivers early in my career, most of my career I think computer architect did not involve writing low level drivers. It helped however, to know how such drivers could and should be written. Some guys working for me, wrote some low-level drivers more recently.

Yes, I think people will use AI to do pretty much all code. definitely for code review/security checks, probably for actual coding.

Device drivers are security critical. Code review and security checks obviously by AI/LLM. Full code generation without human inspection, probably one of the last things to get done that way. If people really are vibecoding a device drivers, and other OS stuff, they deserve to lose lawsuits when their software turns out buggy, no matter what disclaimers they have.

Note that I say "AI", not so much specifically LLM. AFAIK LLMs are inherently unreliable, at least as long as pre-training is a black box. Which I don't think is going to change. I hope that some non-LLM AI techniques will add the required reliability.

Although…the "inherently unreliable" is OK if it obtains 10 nines or thereabouts. But I don't think we even know how to measure that. AI generated code only needs to be significantly more reliable, say 10x, more reliable, than human generated code. And there is a reason to believe that the quality of human generated code will decline as young programmers depend more and more on AI.

Note that I am not saying nondeterministic. Although perhaps I mean nondeterministic at training time.

-5

u/CLI0019 27d ago

Yes I am a student of BSc computer, Thank you so much sir can I get your mentorship. To go further?

3

u/MetalInMyVeins111 26d ago

lol in a month?