[PATCH] D88345: [CUDA] Allow local `static const {__constant__, __device__}` variables.

Justin Lebar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 28 16:38:04 PDT 2020


jlebar added a comment.

> It should. I did mention in a previous comment that > Looks like the const-ness check should not be there, either. I need to revise the patch.

Heh, okay.  Sorry I missed that, somehow this patch was confusing to me.

> Except that NVCC allows non-const __constant__, too. Generally speaking, C++ does not care about the attributes. While technically __constant__ is not changeable from the device code, not specifying const is a missed optimization/diagnostic opportunity, but not an error per se. It does not affect how the variable is emitted, but rather what user can do with it and that's beyond the scope of this patch. I don't think it warrants a hard error. A warning, perhaps, that non-const __constant__ is probably an error?

Sure, that makes sense to me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88345/new/

https://reviews.llvm.org/D88345



More information about the cfe-commits mailing list