Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bugfix][TIR] Fix duplicate AllocateConst in CacheReadWrite schedule …
…primitive (#16660) * [Bugfix][TIR] Fix duplicate AllocateConst in CacheReadWrite schedule primitive When inserting a `cache_read` / `cache_write` stage, the `tir.AllocateConst` statement would be duplicated if its body was not a `tir.SeqStmt` node (e.g. `tir.For`), leading to compilation failures. This happened because `tir.AllocateConst` and `tir.DeclBuffer` statements are always re-attached to the statement's body after the `cache_read` / `cache_write` stage is inserted in it, but the stage was being appended to the whole statement (which already contains the `tir.AllocateConst`) and not just its body, causing duplications. This commit also adds a test where the first `cache_read` stage is inserted into a statement whose body is a `tir.For`, while the second stage is added to a body that is `tir.SeqStmt` to check for regressions. * Improve PrimFunc readability * Remove redundant `T.reads()`
- Loading branch information