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

Update BF16 amp list #39304

Merged
merged 5 commits into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ def _update_list(self):
bf16_initializer_list = {'fill_constant', 'uniform_random'}

# always bf16
bf16_list = {'elementwise_add', 'mul'}
arlesniak marked this conversation as resolved.
Show resolved Hide resolved
bf16_list = {
'conv2d',
'matmul',
'matmul_v2',
'mul',
}

# depends on the prev_op type
gray_list = {
Expand Down
16 changes: 8 additions & 8 deletions python/paddle/fluid/contrib/tests/test_bf16_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,20 @@ def test_amp_lists_3(self):
self.amp_lists_ = amp.bf16.AutoMixedPrecisionListsBF16({'lstm'})

def test_amp_lists_4(self):
# 4. w=None, b={'elementwise_add'}
self.bf16_list.remove('elementwise_add')
self.fp32_list.add('elementwise_add')
# 4. w=None, b={'matmul_v2'}
self.bf16_list.remove('matmul_v2')
self.fp32_list.add('matmul_v2')

self.amp_lists_ = amp.bf16.AutoMixedPrecisionListsBF16(
custom_fp32_list={'elementwise_add'})
custom_fp32_list={'matmul_v2'})

def test_amp_lists_5(self):
# 5. w=None, b={'elementwise_add'}
self.fp32_list.add('elementwise_add')
self.bf16_list.remove('elementwise_add')
# 5. w=None, b={'matmul_v2'}
self.fp32_list.add('matmul_v2')
self.bf16_list.remove('matmul_v2')

self.amp_lists_ = amp.bf16.AutoMixedPrecisionListsBF16(
custom_fp32_list={'elementwise_add'})
custom_fp32_list={'matmul_v2'})

def test_amp_lists_6(self):
# 6. w=None, b={'lstm'}
Expand Down