Skip to content

Make trivial thread-idx for degenerate statements without thread-idx.#36480

Closed
zheng-xq wants to merge 5 commits intogh/zheng-xq/3/basefrom
gh/zheng-xq/3/head
Closed

Make trivial thread-idx for degenerate statements without thread-idx.#36480
zheng-xq wants to merge 5 commits intogh/zheng-xq/3/basefrom
gh/zheng-xq/3/head

Conversation

@zheng-xq
Copy link
Copy Markdown
Contributor

@zheng-xq zheng-xq commented Apr 13, 2020

Stack from ghstack:

Differential Revision: D20992505

@zheng-xq zheng-xq requested a review from apaszke as a code owner April 13, 2020 11:33
@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Apr 13, 2020
@dr-ci
Copy link
Copy Markdown

dr-ci Bot commented Apr 13, 2020

💊 Build failures summary and remediations

As of commit 77dee3f (more details on the Dr. CI page):


  • 1/1 failures introduced in this PR

XLA failure

Job pytorch_xla_linux_bionic_py3_6_clang9_build is failing. Please create an issue with title prefixed by [PT_BREAK] in pytorch/xla and link to to this PR. If you have questions, please reach out to @ailzhang / @dlibenzi / @JackCaoG.


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker.

See how this bot performed.

This comment has been revised 15 times.

Copy link
Copy Markdown

@ZolotukhinM ZolotukhinM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, some comments are inline!

Comment thread torch/csrc/jit/tensorexpr/cuda_codegen.cpp Outdated
}

// Find all the statements that are not covered by any thread-idx axes,
// and wrapp them under a trivial thread idx.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: wrapp.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread torch/csrc/jit/tensorexpr/cuda_codegen.cpp
std::list<Stmt*> old_stmts = v->stmts();
std::vector<bool> need_rewrites(old_stmts.size());
std::vector<Stmt*> new_stmts(old_stmts.size());
;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: unnecessary ";"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread torch/csrc/jit/tensorexpr/cuda_codegen.cpp Outdated
Comment thread torch/csrc/jit/tensorexpr/cuda_codegen.cpp Outdated

start = stop;
}
Stmt* rewritten_block = Block::make(rewrite_stmts);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add an assert that rewrite_stmts.size() == new_stmts.size() == old_stmts.size()?

Comment thread torch/csrc/jit/tensorexpr/cuda_codegen.cpp
b_ref(i) = i;
}

float* a_dev = nullptr;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running the codegen is not sufficient here, I think. Can you verify the correct code was generated in a literal way?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a TODO to add the check in a follow-up.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@zheng-xq merged this pull request in 32bbf12.

@facebook-github-bot facebook-github-bot deleted the gh/zheng-xq/3/head branch April 20, 2020 14:17
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
…pytorch#36480)

Summary: Pull Request resolved: pytorch#36480

Test Plan: Imported from OSS

Differential Revision: D20992505

Pulled By: zheng-xq

fbshipit-source-id: 3d4e5401b59b9507b5f2db659e511bd1af53f5ab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged oncall: jit Add this issue/PR to JIT oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants