[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-10-07 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. In D110089#3049656 , @kgk wrote: > Very cool! I am selfishly curious if support for surface operations is > something you plan to add. I had a go at implementing it myself today based > on this patch, and found it a bit harder than

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-10-07 Thread Kevin Greene via Phabricator via cfe-commits
kgk added a comment. In D110089#3048460 , @tra wrote: > In D110089#3047161 , @kgk wrote: > >> Will the new macros in this patch also be useful for supporting the >> surface-related methods that also use __nv_tex_

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-10-07 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. In D110089#3047161 , @kgk wrote: > Will the new macros in this patch also be useful for supporting the > surface-related methods that also use __nv_tex_surf_handler (from > surface_indirect_functions.h)? > > I gave this new code a t

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-10-06 Thread Kevin Greene via Phabricator via cfe-commits
kgk added a comment. Will the new macros in this patch also be useful for supporting the surface-related methods that also use __nv_tex_surf_handler (from surface_indirect_functions.h)? I gave this new code a try with surf2Dread and surf2Dwrite, and based on the errors, it look like it may jus

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-10-06 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment. Fixed in 6707a7d7e96ac23ba66f16bdb44927082d2fd4d3 , thanks! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110089/new/ https://reviews.llvm.org/D110089 __

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-10-06 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment. This breaks tests on Mac: http://45.33.8.238/macm1/19372/step_7.txt Please take a look :) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110089/new/ https://reviews.llvm.org/D110089 _

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-10-06 Thread Artem Belevich via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGccfb0555f76b: [CUDA] Implement experimental support for texture lookups. (authored by tra). Repository: rG LLVM Github Monorepo CHANGES SINCE LAS

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-10-06 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 377703. tra added a comment. Use `int` for string hash calculations to avoid dealing with char signedness. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110089/new/ https://reviews.llvm.org/D110089 Files: clang/

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-10-06 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 377687. tra added a comment. Removed obsolete comment. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110089/new/ https://reviews.llvm.org/D110089 Files: clang/lib/Headers/CMakeLists.txt clang/lib/Headers/__cla

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-24 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. In D110089#3021652 , @jlebar wrote: > Okay, I give up on the phab interface. It's unreadable with all the existing > comments and lint errors. Yeah. Phabricator experience is not great. > +// Put all functions into anonymous namesp

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-24 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 374979. tra added a comment. More comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110089/new/ https://reviews.llvm.org/D110089 Files: clang/lib/Headers/CMakeLists.txt clang/lib/Headers/__clang_cuda_run

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-24 Thread Justin Lebar via Phabricator via cfe-commits
jlebar added a comment. Presumably as a separate commit we should add tests to the test_suite repository to ensure that this at least still compiles with different versions of CUDA? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110089/new/ https:

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-24 Thread Justin Lebar via Phabricator via cfe-commits
jlebar accepted this revision. jlebar added a comment. Okay, I give up on the phab interface. It's unreadable with all the existing comments and lint errors. Hope you don't mind comments this way. I'm just going to put it all in a giant code block so it doesn't get wrapped or whatever. +// _

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-23 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 374644. tra added a comment. Sort push/pop_macro. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110089/new/ https://reviews.llvm.org/D110089 Files: clang/lib/Headers/CMakeLists.txt clang/lib/Headers/__clang_cu

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-23 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 374642. tra added a comment. Disable sparse ops for pre-sm_60 GPUs. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110089/new/ https://reviews.llvm.org/D110089 Files: clang/lib/Headers/CMakeLists.txt clang/lib/

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-23 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 374604. tra added a comment. Added a test. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110089/new/ https://reviews.llvm.org/D110089 Files: clang/lib/Headers/CMakeLists.txt clang/lib/Headers/__clang_cuda_runt

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-22 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 374405. tra added a comment. Removed a test file committed by mistake. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110089/new/ https://reviews.llvm.org/D110089 Files: clang/lib/Headers/CMakeLists.txt clang/l

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-22 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 374404. tra added a comment. Cleanups. Added more comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110089/new/ https://reviews.llvm.org/D110089 Files: clang/lib/Headers/CMakeLists.txt clang/lib/Headers/

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-22 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments. Comment at: clang/lib/Headers/__clang_cuda_texture_intrinsics.h:41 + +namespace { + jlebar wrote: > jlebar wrote: > > what are you trying to accomplish with an anon ns inside a header? > I know you wrote it in the commit message, but th

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-22 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 374391. tra marked 2 inline comments as done. tra added a comment. Added better C++11 guards. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110089/new/ https://reviews.llvm.org/D110089 Files: clang/lib/Headers/C

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-22 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 374362. tra added a comment. Require c++11 for texture support. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110089/new/ https://reviews.llvm.org/D110089 Files: clang/lib/Headers/CMakeLists.txt clang/lib/Head

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-22 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 374360. tra added a comment. Switched to purely in-header implementation based on constexpr perfect hash. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110089/new/ https://reviews.llvm.org/D110089 Files: clang/l

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-22 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. In D110089#3016145 , @jlebar wrote: >> Depending on which particular operation is used, the arguments vary, too. > > So something like > > T __nv_tex_surf_handler(name, arg1) { > switch (name) { > ... > default: >

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-22 Thread Justin Lebar via Phabricator via cfe-commits
jlebar added a comment. > Depending on which particular operation is used, the arguments vary, too. So something like T __nv_tex_surf_handler(name, arg1) { switch (name) { ... default: panic(); } } T __nv_tex_surf_handler(name, arg1, arg2) { switch(...) {

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-22 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. In D110089#3014388 , @jlebar wrote: >> One alternative would be to use run-time dispatch, but, given that texture >> lookup is a single instruction, the overhead would be >> substantial-to-prohibitive. > > I guess I'm confused... I

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-21 Thread Justin Lebar via Phabricator via cfe-commits
jlebar added a comment. > One alternative would be to use run-time dispatch, but, given that texture > lookup is a single instruction, the overhead would be > substantial-to-prohibitive. I guess I'm confused... Is the parameter value that we're "overloading" on usually/always a constant? In

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-21 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. Most of clang-tidy warnings are irrelevant -- it tries to parse the header all by itself, without CUDA headers. It also ignores `NOLINTNEXTLINE(clang-diagnostic-error)` which was intended to suppress the warning triggered by `#error`. The only useful one was in SemaChecking

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-21 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 374034. tra added a comment. Undo useless NOLINT Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110089/new/ https://reviews.llvm.org/D110089 Files: clang/include/clang/Basic/Builtins.def clang/include/clang/Sem

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-21 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 374028. tra added a comment. Minor cleanups Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110089/new/ https://reviews.llvm.org/D110089 Files: clang/include/clang/Basic/Builtins.def clang/include/clang/Sema/Sem

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-21 Thread Michael Liao via Phabricator via cfe-commits
hliao accepted this revision. hliao added a comment. This revision is now accepted and ready to land. Cool! I like the idea of *compile-time* dispatch. LGTM except minor warnings from clang-tidy. Could you fix them before committing this change? Repository: rG LLVM Github Monorepo CHANGES SI

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-20 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 373747. tra edited the summary of this revision. tra added a comment. cosmetic cleanups. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110089/new/ https://reviews.llvm.org/D110089 Files: clang/include/clang/Basi

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-20 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. Here's expanded and formatted version of the header: https://gist.github.com/Artem-B/ec4290809650f5092d61d6dafa6b0131 It may help to see what's going on. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110089/new/ https://review

[PATCH] D110089: [CUDA] Implement experimental support for texture lookups.

2021-09-20 Thread Artem Belevich via Phabricator via cfe-commits
tra created this revision. tra added reviewers: jlebar, yaxunl, hliao. Herald added subscribers: bixia, mgorny. Herald added a reviewer: a.sidorin. tra requested review of this revision. Herald added a project: clang. The patch Implements support for testure lookups (mostly) in a header file. The