Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Add bfloat16 support for CPU #5497

Merged
merged 6 commits into from
Apr 6, 2023
Merged

Conversation

itaraban
Copy link
Collaborator

Description

Enabling BFloat16 data type for CPU.

Checklist

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [$CATEGORY] (such as [NN], [Model], [Doc], [Feature]])
  • I've leverage the tools to beautify the python and c++ code.
  • The PR is complete and small, read the Google eng practice (CL equals to PR) to understand more about small PR. In DGL, we consider PRs with less than 200 lines of core code change are small (example, test and documentation could be exempted).
  • All changes have test coverage
  • Code is well-documented
  • To the best of my knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change
  • Related issue is referred in this PR
  • If the PR is for a new model/paper, I've updated the example index here.

Changes

@dgl-bot
Copy link
Collaborator

dgl-bot commented Mar 24, 2023

To trigger regression tests:

  • @dgl-bot run [instance-type] [which tests] [compare-with-branch];
    For example: @dgl-bot run g4dn.4xlarge all dmlc/master or @dgl-bot run c5.9xlarge kernel,api dmlc/master

@dgl-bot
Copy link
Collaborator

dgl-bot commented Mar 24, 2023

Commit ID: 98d990575b9ffaf571863a36b71bd3a36a4321f5

Build ID: 1

Status: ❌ CI test failed in Stage [Lint Check].

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Mar 24, 2023

Commit ID: 474338faec4b007c47af7534036e631f160a0ebf

Build ID: 2

Status: ❌ CI test failed in Stage [Lint Check].

Report path: link

Full logs path: link

@itaraban itaraban force-pushed the bf16_cpu branch 2 times, most recently from 231f87b to 56c8448 Compare March 24, 2023 11:17
@dgl-bot
Copy link
Collaborator

dgl-bot commented Mar 24, 2023

Commit ID: eac8a0aa8ad169231ff259127e47a86a86842e90

Build ID: 3

Status: ⚪️ CI test cancelled due to overrun.

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Mar 24, 2023

Commit ID: 697014a9ede4e8cbbe6e83e912bef134312efc5e

Build ID: 4

Status: ❌ CI test failed in Stage [Lint Check].

Report path: link

Full logs path: link

@itaraban itaraban force-pushed the bf16_cpu branch 2 times, most recently from 34ba5e9 to 015f570 Compare March 24, 2023 11:39
@dgl-bot
Copy link
Collaborator

dgl-bot commented Mar 24, 2023

Commit ID: 97c58081f947f6930cb118056f72427874960571

Build ID: 5

Status: ⚪️ CI test cancelled due to overrun.

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Mar 24, 2023

Commit ID: 81b2ca734303ab0169942e24407167c6466f3d1a

Build ID: 6

Status: ❌ CI test failed in Stage [CPU Build].

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Mar 24, 2023

Commit ID: 0142fe762f61c411592e604952ba266269a4201f

Build ID: 7

Status: ✅ CI test succeeded.

Report path: link

Full logs path: link

include/dgl/aten/macro.h Show resolved Hide resolved
include/dgl/runtime/bfloat16.h Outdated Show resolved Hide resolved
src/array/cpu/segment_reduce.cc Outdated Show resolved Hide resolved
src/array/cpu/segment_reduce.cc Outdated Show resolved Hide resolved
src/array/cpu/spmm.h Outdated Show resolved Hide resolved
src/array/cpu/spmm.h Outdated Show resolved Hide resolved
@dgl-bot
Copy link
Collaborator

dgl-bot commented Mar 27, 2023

Commit ID: feb7f57ab244f0ddf402bca10ef64609b0822095

Build ID: 8

Status: ✅ CI test succeeded.

Report path: link

Full logs path: link

@frozenbugs
Copy link
Collaborator

There is still one open comment, please address, overall the code style looks great! Thanks.
Add @BarclayII to double check.

@dgl-bot
Copy link
Collaborator

dgl-bot commented Mar 28, 2023

Commit ID: bb4300814fc3ebbeaa7410bacbce6aacc3a0f316

Build ID: 9

Status: ✅ CI test succeeded.

Report path: link

Full logs path: link

@frozenbugs
Copy link
Collaborator

There is still one open comment, please address, overall the code style looks great! Thanks. Add @BarclayII to double check.

LGTM from my side, @BarclayII feel free to approve if this PR looks good to you.

Comment on lines +62 to +63
raw[0] = 0;
raw[1] = val;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it assuming big endian byte order? If it's little endian I think this should be

raw[0] = val;

Also, could we have a test case on converting between bfloat16 and float32?

Copy link
Collaborator

@BarclayII BarclayII left a comment

Choose a reason for hiding this comment

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

LGTM

@dgl-bot
Copy link
Collaborator

dgl-bot commented Apr 5, 2023

Commit ID: 8b980272aa7afec62390856f0a02c97f080f25ea

Build ID: 10

Status: ✅ CI test succeeded.

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Apr 5, 2023

Commit ID: 36d4f56

Build ID: 11

Status: ❌ CI test failed in Stage [Distributed Torch CPU Unit test].

Report path: link

Full logs path: link

@itaraban
Copy link
Collaborator Author

itaraban commented Apr 5, 2023

@dgl-bot

@dgl-bot
Copy link
Collaborator

dgl-bot commented Apr 6, 2023

Commit ID: 2ac0771

Build ID: 12

Status: ✅ CI test succeeded.

Report path: link

Full logs path: link

@itaraban itaraban merged commit acb4eb7 into dmlc:master Apr 6, 2023
DominikaJedynak pushed a commit to DominikaJedynak/dgl that referenced this pull request Mar 12, 2024
Co-authored-by: Hongzhi (Steve), Chen <chenhongzhi.nkcs@gmail.com>
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants