5 ms·
> ChatGPT can't write a kernel device driver, and it can't act as a no-code tool for non-programmers. Those are the hard parts. Oh, do I have news for you then
by wizeman 4y ago
> ChatGPT can't write a kernel device driver, and it can't act as a no-code tool for non-programmers. Those are the hard parts.
Oh, do I have news for you then.
Look at what I just did with ChatGPT in 30 seconds (and I did not cherry-pick, these were the first answers I got!):
https://gist.github.com/wizeman/b269be035308994be745025fc3378f04 https://gist.github.com/wizeman/b269be035308994be745025fc337...
Now to be fair, the code is probably not totally correct, as probably there are parts still missing/wrong and there might even be compilation errors or other problems.
But here's the important part: you can tell which errors or problems you've observed and ChatGPT will fix these problems for you. Exactly like what a programmer does.
And sure, it cannot yet do this at scale, such as in implementing a huge kernel driver like a GPU driver.
But at this rate, give it a few years and an improved version might just be able to do anything a programmer does, perhaps even autonomously if we allow it to interact with a computer like a human does.
- dvt 4y ago> Look at what I just did with ChatGPT in 30 seconds (and I did not cherry-pick, these were the first answers I got!): Weird flex, as that code is like 90% boilerplate[1]. Everyone was freaking out about Copilot and no one seriously ended up using it because it just generates buggy (or copyrighted) code. It can't even handle writing unit tests with decent coverage (which is arguably the most repetitive/boring software engineering task). [1] https://github.com/ngtkt0909/linux-kernel-module-template/blob/develop/00.hello/src/hello.c https://github.com/ngtkt0909/linux-kernel-module-template/bl...
- dragonwriter 4y ago> no one seriously ended up using it [citation needed] I mean, I’ve seen people claiming to use it and that it has significantly accelerating their work. On what are you basing the conclusion that it has no serious use?
- vbezhenar 4y agoI do use it and I'm very picky when it comes to writing code. Here's example of tiny webapp I wrote recently: https://github.com/vbezhenar/pwgen/blob/main/pwgen.html https://github.com/vbezhenar/pwgen/blob/main/pwgen.html Of course it wasn't Copilot writing it, but it definitely helps with boring parts. Like I'd write const charactersElement = document.getElementById('characters'); and rest 10 lines will be written with Copilot with minimal assistance. It's like having stupid but diligent assistant who's happy to copy&paste&adapt parts of code. I can't claim that I often use fully generated Copilot functions. Sometimes I do, often with significant rework, but that's because, as I said, I'm very picky. I paid GitHub $100 already and don't regret it. Though I think that Copilot has plenty of features ahead. For example finding obvious issues in the code would be very useful. Like typos. Another issue with Copilot is that it only generates new code. Imagine that I need to edit 10 similar lines. I edit one line and I'd like Copilot to offer other edits. Also UI is lacking. Like it generates 10 lines but I only like first line. Now I have to add 10 lines and delete 9. But I'm sure that those are obvious directions.
- wizeman 4y ago> Weird flex, as that code is like 90% boilerplate[1]. Isn't 90% of code boilerplate anyway? Also, didn't ChatGPT generate more than just the boilerplate? Didn't it interpret what I wanted and generated the code for computing the factorial as well, as well as modifying the boilerplate (e.g. the kernel module name, printed messages, function names, the module description, ...) so that it matches what the kernel module is supposed to do? Which is exactly what a human would do? Aren't you also missing the fact that I gave it a 2-sentence instruction and it "understood" exactly what to do, and then did it? Like a human programmer would do? Which, in sum, is totally the opposite of what you were claiming? > Everyone was freaking out about Copilot and no one seriously ended up using it because it just generates buggy (or copyrighted) code. Don't most programmers also generate buggy code at first? Don't they iterate until the code works, like what ChatGPT does if you give it feedback about the bugs and problems you've encountered? Also, Copilot and ChatGPT have different levels of capabilities, don't assume just because Copilot can't do something, that ChatGPT can't. ChatGPT is clearly a big step forward as you can clearly see from how everyone is freaking out about it. Finally, don't assume that these models are never going to improve, ever again.
- jraph 4y agoFortunately, a human will know to fix that broken 4-space indentation and that brace placement before inclusion in the Linux kernel repository.
- wizeman 4y ago> Fortunately, a human will know to fix that broken 4-space indentation and that brace placement before inclusion in the Linux kernel repository. What's your point, that ChatGPT wouldn't know how to do that, especially if the kernel maintainers gave it such feedback? I thought it was clear that it can in fact do that (sometimes by asking clarifying questions, like a human would). I think some of the major things missing in ChatGPT is the ability to interact with a computer directly (including the compiler and checkpatch.pl, and using files for information storage instead of a limited N-token context), as well as interacting with humans by itself (e.g. via email). And sure, it would still have very limited capabilities in many ways, don't get me wrong, as I don't think it could replace a programmer at this point. But I think the gaps are closing rapidly.
- jraph 4y agoI was just joking (about the fact that a bot handles the "creative" work of writing the device driver while a human will do the repetitive work of reindenting) (sorry, I should have used /s)
- Arch-TK 4y agoAside from the boilerplate, which it got mostly right as far as I can tell, the actual logic is hilariously wrong. Moreover, Linux kernel development really isn't just writing stand-alone self contained chardev drivers which calculate n!. I would be more impressed if you used chat GPT to guide you through reverse engineering a piece of hardware and implementbing a driver for it.
- wizeman 4y ago> Aside from the boilerplate, which it got mostly right as far as I can tell, the actual logic is hilariously wrong. Please do tell, how is it hilariously wrong? It seems to have written a factorial function just like it should, it implemented the logic to read the integer from /dev/factorial when a user-space program writes to it, and then it writes the result back to /dev/factorial, and it also returns the number of bytes written correctly. Which was the entire point of the exercise. Also note that ChatGPT itself said it was just a sample and it might be incomplete. I noticed it has a bug, because it reads `len` bytes instead of `sizeof(int)` bytes, but a programmer could have made the same mistake. I would also use a fixed-size unsigned integer rather than simply `int` (as it can invoke UB on overflow). You can ask ChatGPT "what is wrong with this code?" and it can spit out the same arguments I'm making. In fact, it detected an infinite-loop bug on piece of complex code which I had just written and indeed, it had an infinite-loop bug. Perhaps some additional logic to handle reading multiple integers and writing multiple answers could be written, but that would be a further iteration of the code, not the initial one that I would write. If that is hilariously wrong, then I would also be hilariously wrong. And I'm not just some random web developer, I actually wrote Linux kernel code professionally for years (although, that was a very long time ago). So, maybe it got some details wrong, but I could conceivably also get those details wrong until I tried to compile/run the code and see what was wrong. > I would be more impressed if you used chat GPT to guide you through reverse engineering a piece of hardware and implementbing a driver for it. Yes, I would be more impressed with that as well. Perhaps someone will do that sometime. Even if not with ChatGPT, perhaps with a future version of it or a similar model.
- sigotirandolas 4y ago
- wizzwizz4 4y ago> Please write me a small Linux kernel driver that calculates the factorial of a number when a user program writes an integer to /dev/factorial. The kernel driver outputs the answer to /dev/factorial as well. That's not a device driver. https://en.wikipedia.org/wiki/Device_driver https://en.wikipedia.org/wiki/Device_driver > In computing, a device driver is a computer program that operates or controls a particular type of device that is attached to a computer or automaton. I'm not disputing it can do that – plugging together well-known APIs and well-known programming problems. That's practically just style transfer, something we know these systems are fairly good at. But given the spec for an unknown device – even quite a simple one – ChatGPT can't produce a device driver for it. How about this? > An HP CalcPad 200 Calculator and Numeric Keypad behaves as a USB keyboard does. It has VID 0x040B and PID 0x2367. Please write me a small Linux kernel driver that allows me to use this keypad as a MouseKeys-style mouse device. If there's anything you don't understand, let me know. I doubt any amount of prompt engineering would produce a satisfactory result – but if you did the hard part, and explained how it should do this? Well… maybe it'd be able to give a satisfactory output. But at that point, you're just programming in a high-level, hard-to-model language. It's not a case of scale. Sure, a very large model might be able to do this, particular problem – but only because it'd have memorised code for a USB keyboard driver, and code for a MouseKeys implementation… and, heck, probably code for a MouseKeys kernel driver from somebody's hobby project. GPT language models don't understand things: they're just very good at guessing. I've been an expert, and a schoolchild; I know how good you can get at guessing without any kind of understanding, and I know enough about what understanding feels like to know how it's different. (There is no metric you can't game by sufficiently-advanced guessing, but you'll never notice an original discovery even if you do accidentally stumble upon one.)