Repository navigation
Conversation
💊 CI failures summary and remediationsAs of commit 417533d (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 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. This comment has been revised 11 times. |
|
@mruberry -- do you want to review this PR? |
|
@VitalyFedyunin is probably a better reviewer for porting PRs. |
VitalyFedyunin
left a comment
There was a problem hiding this comment.
Overall good, just small comments.
| iter.dtype(), "masked_fill_cuda", [&] { | ||
| scalar_t scalar_val = value.to<scalar_t>(); | ||
| auto mask_dtype = iter.input_dtype(1); | ||
| if (mask_dtype == at::ScalarType::Bool) { |
There was a problem hiding this comment.
Please keep TORCH_WARN("masked_fill_ received a mask with dtype torch.uint8, this behavior is now deprecated," \ "please use a mask with dtype torch.bool instead.");
Maybe change it to TORCH_WARN_ONCE
There was a problem hiding this comment.
Or better move this warning to common (CPU,CUDA) code.
There was a problem hiding this comment.
masked_fill_impl in ATen/native/TensorAdvancedIndexing.cpp warns.
https://github.com/pytorch/pytorch/pull/38061/files#diff-5312d553f68ae8e12304275aab5ac43cR574-R575
|
Did you had chance to figure out the issue with smaller sizes perf on GPU? |
facebook-github-bot
left a comment
There was a problem hiding this comment.
@VitalyFedyunin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
No idea, unfortunately... |
Summary: This is the prototype for the modular utils that we've been discussing. It is admittedly a large PR, but a good fraction of that is documentation and examples. I've trimmed a bit on the edges since we last discussed this design (for instance Timer is no longer Fuzzer aware), but it's mostly the same. In addition to the library and hermetic examples, I've included `examples.end_to_end` which tests #38061 over a variety of shapes, dtypes, degrees of broadcasting, and layouts. (CC crcrpar) I only did CPU as I'm not set up on a GPU machine yet. [Results from my devserver](https://gist.github.com/robieta/d1a8e1980556dc3f4f021c9f7c3738e2) Key takeaways: 1) For contiguous Tensors, larger dtypes (fp32 and fp64) and lots of reuse of the mask due to broadcasting, improvements are significant. (Presumably due to better vectorization?) 2) There is an extra ~1.5 us overhead, which dominates small kernels. 3) Cases with lower write intensity (int8, lower mask fraction, etc) or non-contiguous seem to suffer. Hopefully this demonstrates the proof-of-concept for how this tooling can be used to tune kernels and assess PRs. Looking forward to thoughts and feedback. Pull Request resolved: #38338 Differential Revision: D21551048 Pulled By: robieta fbshipit-source-id: 6c50e5439a04eac98b8a2355ef731852ba0500db
|
masked_fill is ported |
Related issue: #24303
This PR changes CPU implementation of #33330 though I don't see terrible regression as follows.
Profiling
CPU
Benchmark is executed with https://github.com/mingfeima/op_bench-py on the machine with 12 Intel(R) Core(TM) i7-7800X CPU @ 3.50GHz.
GPU
I see some regression in GPU kernel so investigating now.