# Minimal kernel name length

• 12-30-2012, 11:26 AM
PhilTillet
Minimal kernel name length
Hello,

I have searched in the standards and couldn't find the minimum kernel length as defined by the standards...
Does anybody know what it is?

Thanks !
• 12-30-2012, 04:18 PM
Dithermaster
Re: Minimal kernel name length
I'd expect the minimum name length for a kernel to be 1 alpha character. Why is this important, and why not just try it rather than ask here?
• 12-31-2012, 06:28 AM
PhilTillet
Re: Minimal kernel name length
Hey,

this matters when dynamically generate code, and when the kernel function name also has to be generated. It can be useful to know if we generate a name too long for the standards for portability issues...

These numbers can be found for C99 http://c0x.coding-guidelines.com/5.2.4.1.html , and I'm wondering if they are the same for OpenCL, that is 31 characters for external identifier and 63 for internal identifiers, because i couldn't find the explicit information in the OpenCL specifications...

I tested it on AMD/NVidia and had different results.
• 12-31-2012, 03:19 PM
Dithermaster
Re: Minimal kernel name length
So what you're looking for is the maximum unique name length, not minimum.

With 31 characters you could name every atom on earth. Do you have more kernels than that?

Even if you could create 40,000 kernels per second, you'd only need 7 characters to name as many of you could generate in a year.
• 12-31-2012, 11:12 PM
PhilTillet
Re: Minimal kernel name length
I can feel your sarcasm :D
Indeed I made quite a mistake in my question, confusing minimal and maximal.

It was more a matter of knowing until when we can have a unique representation in the kernel name. If you are generating code for arbitrary long linear algebra expression, then including all the possible operators and datastructures involved in an operation you get a pretty big set of possible operations.

x = Ax - y + s*z or x = Ax + s*z - y that is the same but maps to a different expression tree
y = w + sin(x) + cos(y)
z = w + A*sin(x)...

Of course, my problem only arise if I want the kernel name to describe the operation it does, I can indeed maintain a counter with which I could generate kernels until the next prediction of the end of the world without having to worry about kernel name error :D