Address space qualifiers are a bit overboard

Metal is great. I love the API's design.

One thing though about MSL is that it renders using preexisting C++ functions useless due to explicit address space qualifiers.

Was that decision made for the sake of lower compile times?

With CUDA, which isn't too dissimilar, it can inherit the address space of a pointer.

Let's say I have a very large collection of useful headers as a git submodule from somewhere I do not maintain myself. In MSL I cannot just use them, but rather have to modify each and every function declaration such that the argument list includes the ASQ.

Example:
Code Block
// some header only lib
void usefulFunction(MyType& a) { ... }
...
// calling kernel code
device MyType* x;
MyType x0 = x[0];
usefulFunction(x[0]);
usefulFunction(x0);


Non of the above works.

In CUDA this isn't an issue.








Yes, CUDA allows you to use a generic address space. This requires the GPU to have a page table that can use a uniform address space across all types of memory. In other words, the hardware page table needs to be able find the memory of an address regardless of what space the memory resides.

Not all GPUs supported by Metal have this capability.
You probably misread my question. I am not looking for a unified address space.

I am saying that the language extension to specify address space in function arguments is overqualified.

In CUDA, if I pass a device or shared pointer to a function with just a blank pointer, the address space is inferred from the calling actual parameter. This is compiler problem, not a GPU driver LCD problem.

The main issue with this is that you cannot use third party code without modifying *all* and every function header.

Does this make sense now?
Address space qualifiers are a bit overboard
 
 
Q