Skip to content

Commit 35a8b91

Browse files
authored
[LLGA] add profileName for LlgaKernel (#40)
1 parent d3990d4 commit 35a8b91

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

torch_ipex/csrc/jit/codegen/onednn/interface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void fuseGraph(std::shared_ptr<Graph>& g) {
4949
Operation createLlgaKernel(const Node* node) {
5050
auto kernel = std::make_shared<fuser::onednn::LlgaKernel>(node);
5151
return [kernel](Stack* stack) {
52-
RECORD_FUNCTION(kernel->debugName(), std::vector<c10::IValue>());
52+
RECORD_FUNCTION(kernel->profileName(), std::vector<c10::IValue>());
5353
kernel->run(*stack);
5454
return 0;
5555
};

torch_ipex/csrc/jit/codegen/onednn/kernel.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ LlgaKernel::LlgaKernel(const Node* fusionNode)
5555
graph_(fusionNode->g(attr::Subgraph)),
5656
nInputs_(graph_->inputs().size()),
5757
nOutputs_(graph_->outputs().size()),
58-
debugName_(genDebugName()) {
58+
debugName_(genDebugName()),
59+
profileName_(genProfileName()) {
5960
// TODO: This is a workaround to recreate the partitions here.
6061
// The ideal way is to use the partition serialization API (not available from LLGA now)
6162
// to carry a serialized string representation from graph rewrite and deserialize it here.

torch_ipex/csrc/jit/codegen/onednn/kernel.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ class LlgaKernel {
2929
return debugName_;
3030
}
3131

32+
const std::string& profileName() const {
33+
return profileName_;
34+
}
35+
3236
private:
3337
bool useOpaqueLayout(size_t offset) const;
3438

@@ -57,6 +61,16 @@ class LlgaKernel {
5761
return "LlgaPartition_" + std::to_string(debugId++);
5862
}
5963

64+
std::string genProfileName() {
65+
std::vector<std::string> op_list;
66+
for (auto* node : graph_->block()->nodes()) {
67+
if (node->kind().is_aten()) {
68+
op_list.push_back(node->kind().toUnqualString());
69+
}
70+
}
71+
return c10::Join("+", op_list);
72+
}
73+
6074
static dnnl::graph::logical_tensor toLogicalTensor(const ArgSpec& s) {
6175
return s.logical_tensor();
6276
}
@@ -68,6 +82,7 @@ class LlgaKernel {
6882
int64_t nOutputs_ = 0;
6983
dnnl::graph::partition partition_;
7084
std::string debugName_;
85+
std::string profileName_;
7186
};
7287

7388
} // namespace onednn

0 commit comments

Comments
 (0)