Skip to content

Enable BF16 for indexing on CUDA - #48801

Closed
zasdfgbnm wants to merge 5 commits into
masterfrom
bfloat-indexing-cuda
Closed

zasdfgbnm wants to merge 5 commits into
masterfrom
bfloat-indexing-cuda

Conversation

@zasdfgbnm

Copy link
Copy Markdown
Collaborator

Fixes #{issue number}

@dr-ci

dr-ci Bot commented Dec 3, 2020 •

Copy link
Copy Markdown

💊 CI failures summary and remediations

As of commit 91d13eb (more details on the Dr. CI page):


✅ None of the CI failures appear to be your fault 💚



🚧 1 ongoing upstream failure:

These were probably caused by upstream breakages that are not fixed 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 to the (internal) Dr. CI Users group.

This comment has been revised 8 times.

@codecov

codecov Bot commented Dec 4, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #48801 (464e35c) into master (19f4c51) will increase coverage by 0.02%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master   #48801      +/-   ##
==========================================
+ Coverage   80.77%   80.79%   +0.02%     
==========================================
  Files        1867     1865       -2     
  Lines      201583   201099     -484     
==========================================
- Hits       162819   162470     -349     
+ Misses      38764    38629     -135     

@ailzhang
ailzhang requested a review from ngimel December 7, 2020 19:13
@ailzhang ailzhang added module: bfloat16 triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module labels Dec 7, 2020
@ngimel

ngimel commented Dec 14, 2020

Copy link
Copy Markdown
Collaborator

Are there any index_put and index_select tests for bfloat16? Index_put is just advanced indexing I think.

@zasdfgbnm

zasdfgbnm commented Dec 14, 2020 •

Copy link
Copy Markdown
Collaborator Author

@ngimel index_select does not test different dtypes. Advanced indexing dtypes are funny

    @dtypes(torch.float, torch.bfloat16, torch.long, torch.bool)
    @dtypesIfCPU(torch.float, torch.long, torch.bool, torch.bfloat16)
    @dtypesIfCUDA(torch.half, torch.long, torch.bool)
    def test_index_put_src_datatype(self, device, dtype):
        src = torch.ones(3, 2, 4, device=device, dtype=dtype)
        vals = torch.ones(3, 2, 4, device=device, dtype=dtype)
        indices = (torch.tensor([0, 2, 1]),)
        res = src.index_put_(indices, vals, accumulate=True)
        self.assertEqual(res.shape, src.shape)

    @dtypes(torch.float, torch.bfloat16, torch.long, torch.bool)
    @dtypesIfCPU(torch.float, torch.long, torch.bfloat16, torch.bool)
    @dtypesIfCUDA(torch.half, torch.long, torch.bfloat16, torch.bool)
    def test_index_src_datatype(self, device, dtype):
        src = torch.ones(3, 2, 4, device=device, dtype=dtype)
        # test index
        res = src[[0, 2, 1], :, :]
        self.assertEqual(res.shape, src.shape)
        # test index_put, no accum
        src[[0, 2, 1], :, :] = res
        self.assertEqual(res.shape, src.shape)

I don't know why some dtypes are tested, some are not. But I have added it to the list in 0c723ad.

@facebook-github-bot facebook-github-bot left a comment

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.

@ngimel has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@zasdfgbnm
zasdfgbnm deleted the bfloat-indexing-cuda branch December 15, 2020 02:13
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@ngimel merged this pull request in 50b361a.

facebook-github-bot pushed a commit that referenced this pull request Jan 6, 2021
Summary:
Dependency:
#48809 #48807 #48806 #48805 #48801 #44994 #44848

Pull Request resolved: #48810

Reviewed By: mruberry

Differential Revision: D25772955

Pulled By: ngimel

fbshipit-source-id: 353f130eb701f8b338a826d2edaea69e6e644ee9
hwangdeyu pushed a commit to hwangdeyu/pytorch that referenced this pull request Jan 14, 2021
Summary:
Dependency:
pytorch#48809 pytorch#48807 pytorch#48806 pytorch#48805 pytorch#48801 pytorch#44994 pytorch#44848

Pull Request resolved: pytorch#48810

Reviewed By: mruberry

Differential Revision: D25772955

Pulled By: ngimel

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

Labels

cla signed Merged module: bfloat16 open source triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants