Add StreamExecutor kernel types.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Looks pretty good to me.
streamexecutor/include/streamexecutor/Kernel.h | ||
---|---|---|
11 ↗ | (On Diff #66721) | If we're being helpful, maybe s/on a device/on a GPU or other accelerator/. |
14 ↗ | (On Diff #66721) | Too many adjectives in a row. "user API's" |
15 ↗ | (On Diff #66721) | s/unsafe/type-unsafe/? |
18 ↗ | (On Diff #66721) | s/methods/functions/? |
18 ↗ | (On Diff #66721) | Uber-nit, but "type-safe"? The latter seems ~5x more common in my searching. |
23 ↗ | (On Diff #66721) | One thing I don't get is, why do we have to implement a Launch function like this at all? Surely a better API would be to do Kernel.Launch(a1, a2, a3); ? |
24 ↗ | (On Diff #66721) | I'm finding these code blocks pretty hard to read. I'm sure they look great in doxygen, but...even under the highly generous estimate that as many people are going to read this in doxygen as in source, that's still a pretty bad situation. What if we indented the code two or four spaces? |
28 ↗ | (On Diff #66721) | Maybe s/The problem/A problem/ or something? |
97 ↗ | (On Diff #66721) | In general if you implement a move (copy) constructor, you should implement a move (copy) assignment operator. |
streamexecutor/lib/unittests/KernelTest.cpp | ||
52 ↗ | (On Diff #66721) | Not sure about this comment...it will just return null, but not do anything unsafe? But maybe you want to return an error or something the second time? Or assert()? |
85 ↗ | (On Diff #66721) | If I'm honest I have no idea what this is testing. Maybe it is not in fact currently testing anything? :) If so I would almost prefer you wait to add it until we actually have something to test, so that I can better judge whether it's doing something reasonable. But if there's a reason to do it this way, that's fine too. |
jlebar, thanks for your review on this. I'm sorry this patch has been so hard to read. :) Hopefully it's improved a lot now.
streamexecutor/include/streamexecutor/Kernel.h | ||
---|---|---|
23 ↗ | (On Diff #66721) | It's because the real launch function is used in chaining like this Stream.Initialize(...).thenMemcpyToDevice(...).thenLaunch(...).thenMemcpyToHost(...).thenBlock(...); |
24 ↗ | (On Diff #66721) | Sorry about that. I tried indenting them four spaces. I think it helps a lot. |
streamexecutor/lib/unittests/KernelTest.cpp | ||
52 ↗ | (On Diff #66721) | I added an assert and changed the comment to warn about the assert. |
85 ↗ | (On Diff #66721) | Sorry for the confusing code. I added a comment to the test to describe what it's doing and I changed the test name to better describe what is going on. From my point of view, I think that it is really testing something, but I admit that it's testing something very simple. Let me know if you think the functionality it is testing is too simple to need a test. |
Oh, and in response to our offline discussion about gmock. I realized that gmock is not used in LLVM, so I'm not going to use it either. So, I removed the comment that mentioned gmock and I'm now just defining my mock class without mentioning gmock.
streamexecutor/lib/Kernel.cpp | ||
---|---|---|
42 ↗ | (On Diff #66749) | This needed a std::move() for me to build with GCC 5 on Ubuntu or Apple Clang on OS X. |
I'm sorry this patch has been so hard to read. :)
Oh, sorry if I gave you the wrong impression. I do a lot of reviews, and your patches are consistently in the top quintile, both for readability and just in general. This one is no exception!
Thank you for the fixes, this looks good to me (modulo the outstanding std::move issue).
streamexecutor/include/streamexecutor/Kernel.h | ||
---|---|---|
24 ↗ | (On Diff #66749) | Ah, I see. Okay! |
streamexecutor/lib/unittests/KernelTest.cpp | ||
86 ↗ | (On Diff #66749) | Okay, I get it now! Thanks. This is fine. Like you say it's simple, but that's not a problem. |
- Fix bug found by jprice
streamexecutor/lib/Kernel.cpp | ||
---|---|---|
42 ↗ | (On Diff #66749) | Thanks for spotting this jprice. I can confirm that it fails to build with GCC 4.8 on Ubuntu as well without the std::move(). I have now added the std::move() to prevent this error. |