Repository navigation
Fixes in MKL add_n to address several regressions - #13021
Conversation
|
@agramesh1, thanks for your PR! By analyzing the history of the files in this pull request, we identified @jinghuangintel to be a potential reviewer. |
|
Can one of the admins verify this patch? |
|
@rmlarsen could you take a look? |
|
Gentle ping, @rmlarsen |
| bool input2_in_mkl_format = mkl_context.input2_shape.IsMklTensor(); | ||
|
|
||
| // handle the case of a scalar | ||
| if (!input1_in_mkl_format && !input0.dims()) { |
There was a problem hiding this comment.
prefer input0.dims() == 0.
| mkl_context.output_shape.SetMklTensor(false); | ||
| AllocateOutputSetMklShape(ctx, 0, &out_tensor, o_shape, | ||
| mkl_context.output_shape); | ||
| void* out_o = const_cast<void*>(static_cast<const void*>( |
There was a problem hiding this comment.
You can use tensor->scalar()() to access the scalar value (both lvalue and rvalue), instead of all the ugly casting.
| Tensor* out_tensor = nullptr; | ||
| mkl_context.output_shape.SetMklTensor(false); | ||
| AllocateOutputSetMklShape(ctx, 0, &out_tensor, o_shape, | ||
| mkl_context.output_shape); |
| bool input1_in_mkl_format = input1_shape.IsMklTensor(); | ||
| bool input2_in_mkl_format = input2_shape.IsMklTensor(); | ||
| dnnDelete_F32(Eltwise); | ||
| if (!input1_in_mkl_format || !input2_in_mkl_format) { |
There was a problem hiding this comment.
This condition should be
if (input1_in_mkl_format || input2_in_mkl_format) {
To be the opposite of line 81.
There was a problem hiding this comment.
@agramesh1 are you going to address this one? I think you'll leak memory otherwise.
There was a problem hiding this comment.
@rmlarsen this part is the opposite of line 173 and 182, only in the case that input 1 and input 2 are not in mkl format, we will need to allocate the array. so we will release the buffer only in the case these two are not in mkl format. Thank you ~ please let me know if you have any suggestions. :)
There was a problem hiding this comment.
haha, I guess I didn't look at the fully expanded view :-) Thanks for pointing that out.
|
|
||
| size_t* in2_sizes; | ||
| size_t* in2_strides; | ||
| size_t* in_sizes; |
There was a problem hiding this comment.
set both to nullptr either here or in initializer list of constructor.
rmlarsen
left a comment
There was a problem hiding this comment.
Please address previous comments.
| Tensor* out_tensor = nullptr; | ||
| mkl_context.output_shape.SetMklTensor(false); | ||
| AllocateOutputSetMklShape(ctx, 0, &out_tensor, o_shape, | ||
| mkl_context.output_shape); |
There was a problem hiding this comment.
Still missing an extra indent in line 85.
|
@tensorflow-jenkins test this please |
|
@tensorflow-jenkins test this please |
|
@agramesh1 thanks for the improvement. |
Imported from GitHub PR openxla/xla#13021 replaces EXPECT_OK with TF_EXPECT_OK and added relevant header file and dependency. Error: #10 1431.9 xla/service/gpu/tests/gpu_sparse_dot_test.cc:134:3: error: use of undeclared identifier 'EXPECT_OK' [1792](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1792)#10 1431.9 134 | EXPECT_OK(dense_module); [1793](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1793)#10 1431.9 | ^ [1794](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1794)#10 1431.9 xla/service/gpu/tests/gpu_sparse_dot_test.cc:137:3: error: use of undeclared identifier 'EXPECT_OK' [1795](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1795)#10 1431.9 137 | EXPECT_OK(dense_result); [1796](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1796)#10 1431.9 | ^ [1797](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1797)#10 1431.9 xla/service/gpu/tests/gpu_sparse_dot_test.cc:158:3: error: use of undeclared identifier 'EXPECT_OK' [1798](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1798)#10 1431.9 158 | EXPECT_OK(sparse_module); [1799](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1799)#10 1431.9 | ^ [1800](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1800)#10 1431.9 xla/service/gpu/tests/gpu_sparse_dot_test.cc:161:3: error: use of undeclared identifier 'EXPECT_OK' [1801](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1801)#10 1431.9 161 | EXPECT_OK(sparse_result); [1802](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1802)#10 1431.9 | ^ Copybara import of the project: -- a7d07b02230794d9c13175b39473666d5d067c54 by hmonishN <[email protected]>: fixing build issue for this test -- e45b3b975c40b318ac4918859b364d8e8c3b304a by hmonishN <[email protected]>: fix build error -- 077b7a5b8277cb2e55b57aca64102871326afd0d by Harshit Monish <[email protected]>: Incorporated review comment. Merging this change closes #13021 FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#13021 from hmonishN:hmonish/fix_gpu_sparse_dot_test_build_issue 077b7a5b8277cb2e55b57aca64102871326afd0d PiperOrigin-RevId: 636702747
Imported from GitHub PR openxla/xla#13021 replaces EXPECT_OK with TF_EXPECT_OK and added relevant header file and dependency. Error: #10 1431.9 xla/service/gpu/tests/gpu_sparse_dot_test.cc:134:3: error: use of undeclared identifier 'EXPECT_OK' [1792](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1792)#10 1431.9 134 | EXPECT_OK(dense_module); [1793](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1793)#10 1431.9 | ^ [1794](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1794)#10 1431.9 xla/service/gpu/tests/gpu_sparse_dot_test.cc:137:3: error: use of undeclared identifier 'EXPECT_OK' [1795](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1795)#10 1431.9 137 | EXPECT_OK(dense_result); [1796](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1796)#10 1431.9 | ^ [1797](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1797)#10 1431.9 xla/service/gpu/tests/gpu_sparse_dot_test.cc:158:3: error: use of undeclared identifier 'EXPECT_OK' [1798](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1798)#10 1431.9 158 | EXPECT_OK(sparse_module); [1799](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1799)#10 1431.9 | ^ [1800](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1800)#10 1431.9 xla/service/gpu/tests/gpu_sparse_dot_test.cc:161:3: error: use of undeclared identifier 'EXPECT_OK' [1801](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1801)#10 1431.9 161 | EXPECT_OK(sparse_result); [1802](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1802)#10 1431.9 | ^ Copybara import of the project: -- a7d07b02230794d9c13175b39473666d5d067c54 by hmonishN <[email protected]>: fixing build issue for this test -- e45b3b975c40b318ac4918859b364d8e8c3b304a by hmonishN <[email protected]>: fix build error -- 077b7a5b8277cb2e55b57aca64102871326afd0d by Harshit Monish <[email protected]>: Incorporated review comment. Merging this change closes #13021 FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#13021 from hmonishN:hmonish/fix_gpu_sparse_dot_test_build_issue 077b7a5b8277cb2e55b57aca64102871326afd0d PiperOrigin-RevId: 636702747
Imported from GitHub PR openxla/xla#13021 replaces EXPECT_OK with TF_EXPECT_OK and added relevant header file and dependency. Error: #10 1431.9 xla/service/gpu/tests/gpu_sparse_dot_test.cc:134:3: error: use of undeclared identifier 'EXPECT_OK' [1792](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1792)#10 1431.9 134 | EXPECT_OK(dense_module); [1793](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1793)#10 1431.9 | ^ [1794](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1794)#10 1431.9 xla/service/gpu/tests/gpu_sparse_dot_test.cc:137:3: error: use of undeclared identifier 'EXPECT_OK' [1795](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1795)#10 1431.9 137 | EXPECT_OK(dense_result); [1796](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1796)#10 1431.9 | ^ [1797](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1797)#10 1431.9 xla/service/gpu/tests/gpu_sparse_dot_test.cc:158:3: error: use of undeclared identifier 'EXPECT_OK' [1798](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1798)#10 1431.9 158 | EXPECT_OK(sparse_module); [1799](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1799)#10 1431.9 | ^ [1800](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1800)#10 1431.9 xla/service/gpu/tests/gpu_sparse_dot_test.cc:161:3: error: use of undeclared identifier 'EXPECT_OK' [1801](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1801)#10 1431.9 161 | EXPECT_OK(sparse_result); [1802](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1802)#10 1431.9 | ^ Copybara import of the project: -- a7d07b02230794d9c13175b39473666d5d067c54 by hmonishN <[email protected]>: fixing build issue for this test -- e45b3b975c40b318ac4918859b364d8e8c3b304a by hmonishN <[email protected]>: fix build error -- 077b7a5b8277cb2e55b57aca64102871326afd0d by Harshit Monish <[email protected]>: Incorporated review comment. Merging this change closes #13021 FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#13021 from hmonishN:hmonish/fix_gpu_sparse_dot_test_build_issue 077b7a5b8277cb2e55b57aca64102871326afd0d PiperOrigin-RevId: 636702747
Imported from GitHub PR openxla/xla#13021 replaces EXPECT_OK with TF_EXPECT_OK and added relevant header file and dependency. Error: #10 1431.9 xla/service/gpu/tests/gpu_sparse_dot_test.cc:134:3: error: use of undeclared identifier 'EXPECT_OK' [1792](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1792)#10 1431.9 134 | EXPECT_OK(dense_module); [1793](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1793)#10 1431.9 | ^ [1794](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1794)#10 1431.9 xla/service/gpu/tests/gpu_sparse_dot_test.cc:137:3: error: use of undeclared identifier 'EXPECT_OK' [1795](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1795)#10 1431.9 137 | EXPECT_OK(dense_result); [1796](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1796)#10 1431.9 | ^ [1797](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1797)#10 1431.9 xla/service/gpu/tests/gpu_sparse_dot_test.cc:158:3: error: use of undeclared identifier 'EXPECT_OK' [1798](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1798)#10 1431.9 158 | EXPECT_OK(sparse_module); [1799](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1799)#10 1431.9 | ^ [1800](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1800)#10 1431.9 xla/service/gpu/tests/gpu_sparse_dot_test.cc:161:3: error: use of undeclared identifier 'EXPECT_OK' [1801](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1801)#10 1431.9 161 | EXPECT_OK(sparse_result); [1802](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1802)#10 1431.9 | ^ Copybara import of the project: -- a7d07b02230794d9c13175b39473666d5d067c54 by hmonishN <[email protected]>: fixing build issue for this test -- e45b3b975c40b318ac4918859b364d8e8c3b304a by hmonishN <[email protected]>: fix build error -- 077b7a5b8277cb2e55b57aca64102871326afd0d by Harshit Monish <[email protected]>: Incorporated review comment. Merging this change closes #13021 FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#13021 from hmonishN:hmonish/fix_gpu_sparse_dot_test_build_issue 077b7a5b8277cb2e55b57aca64102871326afd0d PiperOrigin-RevId: 636702747
Imported from GitHub PR openxla/xla#13021 replaces EXPECT_OK with TF_EXPECT_OK and added relevant header file and dependency. Error: #10 1431.9 xla/service/gpu/tests/gpu_sparse_dot_test.cc:134:3: error: use of undeclared identifier 'EXPECT_OK' [1792](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1792)#10 1431.9 134 | EXPECT_OK(dense_module); [1793](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1793)#10 1431.9 | ^ [1794](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1794)#10 1431.9 xla/service/gpu/tests/gpu_sparse_dot_test.cc:137:3: error: use of undeclared identifier 'EXPECT_OK' [1795](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1795)#10 1431.9 137 | EXPECT_OK(dense_result); [1796](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1796)#10 1431.9 | ^ [1797](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1797)#10 1431.9 xla/service/gpu/tests/gpu_sparse_dot_test.cc:158:3: error: use of undeclared identifier 'EXPECT_OK' [1798](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1798)#10 1431.9 158 | EXPECT_OK(sparse_module); [1799](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1799)#10 1431.9 | ^ [1800](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1800)#10 1431.9 xla/service/gpu/tests/gpu_sparse_dot_test.cc:161:3: error: use of undeclared identifier 'EXPECT_OK' [1801](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1801)#10 1431.9 161 | EXPECT_OK(sparse_result); [1802](https://gitlab-master.nvidia.com/dl/openxla/ci/-/jobs/94442414#L1802)#10 1431.9 | ^ Copybara import of the project: -- a7d07b02230794d9c13175b39473666d5d067c54 by hmonishN <[email protected]>: fixing build issue for this test -- e45b3b975c40b318ac4918859b364d8e8c3b304a by hmonishN <[email protected]>: fix build error -- 077b7a5b8277cb2e55b57aca64102871326afd0d by Harshit Monish <[email protected]>: Incorporated review comment. Merging this change closes #13021 PiperOrigin-RevId: 636832662
Fixed failures due to scalar and empty tensors