@@ -569,14 +569,11 @@ bool CIRGenModule::shouldEmitCUDAGlobalVar(const VarDecl *global) const {
569569 // size and host-side address in order to provide access to
570570 // their device-side incarnations.
571571
572- if (global->getType ()->isCUDADeviceBuiltinTextureType ()) {
573- llvm_unreachable (" NYI" );
574- }
575-
576572 return !langOpts.CUDAIsDevice || global->hasAttr <CUDADeviceAttr>() ||
577573 global->hasAttr <CUDAConstantAttr>() ||
578574 global->hasAttr <CUDASharedAttr>() ||
579- global->getType ()->isCUDADeviceBuiltinSurfaceType ();
575+ global->getType ()->isCUDADeviceBuiltinSurfaceType () ||
576+ global->getType ()->isCUDADeviceBuiltinTextureType ();
580577}
581578
582579void CIRGenModule::emitGlobal (GlobalDecl gd) {
@@ -1212,7 +1209,6 @@ CIRGenModule::getOrCreateCIRGlobal(StringRef mangledName, mlir::Type ty,
12121209 // initializer.
12131210 if (gv.isDeclaration ()) {
12141211 getTargetCIRGenInfo ().setTargetAttributes (d, gv, *this );
1215-
12161212 // External HIP managed variables needed to be recorded for transformation
12171213 // in both device and host compilations.
12181214 if (getLangOpts ().CUDA && d && d->hasAttr <HIPManagedAttr>() &&
@@ -1493,7 +1489,8 @@ void CIRGenModule::emitGlobalVarDefinition(const clang::VarDecl *d,
14931489 // because they must not be initialized.
14941490 if (linkage != cir::GlobalLinkageKind::InternalLinkage &&
14951491 (d->hasAttr <CUDADeviceAttr>() || d->hasAttr <CUDAConstantAttr>() ||
1496- d->getType ()->isCUDADeviceBuiltinSurfaceType ())) {
1492+ d->getType ()->isCUDADeviceBuiltinSurfaceType () ||
1493+ d->getType ()->isCUDADeviceBuiltinTextureType ())) {
14971494 gv->setAttr (CUDAExternallyInitializedAttr::getMnemonic (),
14981495 CUDAExternallyInitializedAttr::get (&getMLIRContext ()));
14991496 }
0 commit comments