Added declarations for system calls provided by PTX.
In addition to math functions, we also need to support std::malloc and std::free to match NVCC behavior.
Details
- Reviewers
jlebar
Diff Detail
Event Timeline
Added few more device-side system calls and related wrapper functions.
Added nothrow attributes on malloc/free.
lib/Headers/__clang_cuda_runtime_wrapper.h | ||
---|---|---|
215 | It seems that only vprintf, free, malloc, and __assertfail are syscalls? If so please rejigger this comment so that it's clear what it is and isn't covering. | |
232 | I'd prefer to keep the information from the previous comment: This declaration is there for type-safety, not because things will fail to compile if it is removed. Otherwise someone may look at this, delete this definition, see that everything still works, and conclude that they can safely remove this line. | |
234 | Please put "// extern "C" | |
236 | Nit: Period | |
242 | Please add "//namespace std" |
lg with one question about printf.
lib/Headers/__clang_cuda_runtime_wrapper.h | ||
---|---|---|
237 | I think we want an attribute on this so that we know it's printf-like, so you get appropriate format-string warnings. Unless the compiler is going to add said attribute automatically based on the just the function name. |
lib/Headers/__clang_cuda_runtime_wrapper.h | ||
---|---|---|
232 | I don't quite see what makes vprintf() special compared to other decls here or, let's say, in /usr/include/*.h. I think 'declaration is there for type safety' applies to all of them and does not need to be spelled out for each individual decl. | |
237 | I've verified that lang is already aware that it's printf and checks arguments against format string appropriately. |
Perhaps add a comment explaining where these are implemented?