[PATCH] D53023: Prototype OpenCL BIFs using Tablegen

Andrew Savonichev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 26 08:34:00 PDT 2018


asavonic added a comment.

> TODO
>  Measure the performance / size impact

I looks like the total size of OpenCLBuiltinDecl table should be
~450KB (for ~15000 functions). I guess it can be reduced furthermore by:

1. Replacing return type with an index (you've mentioned this in TODO).
2. Replace extension and a version with a single index.
3. Same for NumArgs and ArgTableIndex - they seem to be really tied together, so maybe we can use a single identifier for them?

With these improvements the total size should become ~175KB, which
seems to be ok, considering that libclangSema.so takes 9.4MB.

In my opinion, even 450KB is a vast improvement over what we have now,
because opencl-c.h alone takes 786KB.



================
Comment at: lib/Sema/SemaExpr.cpp:2131
+          ParmVarDecl::Create(Context, NewFD, SourceLocation(),
+                              SourceLocation(), PP.getIdentifierInfo(arg_name),
+                              ArgTypes[i], nullptr, SC_None, nullptr));
----------------
This dummy identifier name actually makes a diagnostic a bit weird:

    t/gid.cl:3:31: error: too many arguments to function call, expected single argument 'a0', have 2 arguments
    uint gid = get_global_id(0, 2);

It seems to be better if you pass nullptr instead:
    t/gid.cl:4:31: error: too many arguments to function call, expected 1, have 2
    uint gid = get_global_id(0, 1);




https://reviews.llvm.org/D53023





More information about the cfe-commits mailing list