You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/05/17 18:33:38 UTC

[GitHub] [tvm] csullivan commented on pull request #8017: [IR] Add storage scope to PointerType

csullivan commented on pull request #8017:
URL: https://github.com/apache/tvm/pull/8017#issuecomment-842523174


   Good question, the Type subclasses can be used as a type_annotation to [tir variables](https://github.com/csullivan/incubator-tvm/blob/main/include/tvm/tir/var.h#L61). Code generation specifically relies on this type annotation to correctly write an op's function signature and the accesses of that Var. 
   
   Taking #7686 as an example, when generating a function signature for `var` s.t.,
   ```
   var = Var("a_buffer_var", PointerType(PrimType("float16"), "global.texture"))
   ```
   we expect PrintType(var) to return `image2d_t` in OpenCL. In Metal this may be `texture2d<half,>`. 
   
   That's not to say we couldn't use the AST annotation to annotate Vars, but this would require all lowering to respect the fact that Vars may have annotations and thus to carry them forward if any Var binding occurs. OTOH if the storage_scope is part of the type system it is guaranteed to be preserved.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org