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

[Intel MKL] Static code analysis tool fixes. #21665

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions tensorflow/core/common_runtime/mkl_cpu_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,14 @@ class MklCPUAllocator : public VisitableAllocator {
Status s = Status(error::Code::UNIMPLEMENTED,
"Unimplemented case for hooking MKL function.");
TF_CHECK_OK(s); // way to assert with an error message
return nullptr; // return a value and make static code analyzers happy
}

static inline void* ReallocHook(void* ptr, size_t size) {
Status s = Status(error::Code::UNIMPLEMENTED,
"Unimplemented case for hooking MKL function.");
TF_CHECK_OK(s); // way to assert with an error message
return nullptr; // return a value and make static code analyzers happy
}

/// Do we allow growth in BFC Allocator
Expand All @@ -166,6 +168,9 @@ class MklCPUAllocator : public VisitableAllocator {
static constexpr const size_t kAlignment = 64;

VisitableAllocator* allocator_; // owned by this class

// Prevent copying and assignment
TF_DISALLOW_COPY_AND_ASSIGN(MklCPUAllocator);
};

} // namespace tensorflow
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/core/graph/mkl_graph_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace tensorflow {
typedef enum { TENSORS_INTERLEAVED, TENSORS_CONTIGUOUS } MklTfTensorOrdering;
// NOTE: Currently, we use contiguous ordering. If you change this, then you
// would need to change Mkl op definitions in nn_ops.cc.
static MklTfTensorOrdering kTensorOrdering = TENSORS_CONTIGUOUS;
static const MklTfTensorOrdering kTensorOrdering = TENSORS_CONTIGUOUS;

// Get index of MetaData tensor from index 'n' of Data tensor.
inline int DataIndexToMetaDataIndex(int n, int total_tensors) {
Expand Down
3 changes: 3 additions & 0 deletions tensorflow/core/graph/mkl_layout_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,7 @@ void MklLayoutRewritePass::GetDummyMklTensorNode(std::unique_ptr<Graph>* g,
// device of the original
// node.
.Finalize(&**g, out));
CHECK_NOTNULL(*out); // Make sure we got a valid object before using it

// If number of inputs to the original node is > 0, then we add
// control dependency between 1st input (index 0) of the original node and
Expand Down Expand Up @@ -1335,6 +1336,7 @@ void MklLayoutRewritePass::GetDummyWorkspaceTensorNode(
// device of the original
// node.
.Finalize(&**g, out));
CHECK_NOTNULL(*out); // Make sure we got a valid object before using it

// If number of inputs to the original node is > 0, then we add
// control dependency between 1st input (index 0) of the original node and
Expand Down Expand Up @@ -3177,6 +3179,7 @@ void MklLayoutRewritePass::GetDummyMklTensorNode(std::unique_ptr<Graph>* g,
// device of the original
// node.
.Finalize(&**g, out));
CHECK_NOTNULL(*out); // Make sure we got a valid object before using it

// If number of inputs to the original node is > 0, then we add
// control dependency between 1st input (index 0) of the original node and
Expand Down