masahi commented on a change in pull request #8466:
URL: https://github.com/apache/tvm/pull/8466#discussion_r672235542



##########
File path: src/tir/transforms/split_host_device.cc
##########
@@ -89,6 +92,17 @@ class VarUseDefAnalysis : public StmtExprMutator {
 
   Stmt VisitStmt_(const AllocateNode* op) final {
     this->HandleDef(op->buffer_var.get());
+    auto storage_scope = 
runtime::StorageScope::Create(GetPtrStorageScope(op->buffer_var));
+    if (storage_scope.rank == runtime::StorageRank::kDynShared) {
+      ICHECK_EQ(use_dyn_shmem_, false) << "Only one dynamic shared memory 
allocation is allowed.";

Review comment:
       One possible solution is to rewrite the above program to 
   ```
   extern __shared__ char buf[SIZE];
   *((floa32*)&buf[256]) = ((half*)&buf[0])[0] * ((half*)&buf[128])[0];
   ```
   And introduce two intrinsics, `reinterpret_load` / `reinterpret_store`, 
which can be used to express the snippet above by
   ```
   extern __shared__ char buf[SIZE];
   reinterpret_store(&buf[256], "float32", 0, 
    reinterpret_load(&buf[0], "half", 0) * reinterpret_load(&buf[128], "half", 
0));
   ```
   




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to