-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RUNTIME][CLML] Profiling options enabled for CLML (BYOC via JSON Run…
…time) Graph debug runtime to modifications to acommodate profiling through BYOC external calls. Updated TVMC interface to add more formats while profile dump. Added CLML helpers that can rebiuild CPP clml sources from profile dumps. CLML runtime profiling is now controlled by runtime profile flag.
- Loading branch information
1 parent
050b23f
commit 15e86e2
Showing
16 changed files
with
537 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
import os | ||
import sys | ||
import json | ||
import numpy as np | ||
|
||
import tvm | ||
from tvm import relay | ||
from tvm.driver import tvmc | ||
from tvm.relay.op.contrib import clml | ||
from tvm.contrib import utils | ||
from string import Template | ||
|
||
|
||
def main(): | ||
print("CLML Codegen From JSON") | ||
if len(sys.argv) != 3: | ||
print("Usage: python clml_codegen_json.py <json path> <outfile path>") | ||
return | ||
|
||
with open(sys.argv[1], "r") as file: | ||
codegen = json.load(file) | ||
(_, gen_src) = clml.CLMLGenSrc(codegen).get_artifacts() | ||
|
||
f_src = open(sys.argv[2], "w") | ||
f_src.write("\n".join(gen_src)) | ||
f_src.close() | ||
os.popen("clang-format-15 -i " + sys.argv[2]) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
import sys | ||
import numpy as np | ||
|
||
|
||
def main(): | ||
print("Compare given numpy array in npz files") | ||
if len(sys.argv) != 4: | ||
print("Usage: python compare_npy.py <npz file 1> <npz file 2> <np array to cpmpare>") | ||
return | ||
|
||
in1 = np.load(sys.argv[1]) | ||
in2 = np.load(sys.argv[2]) | ||
|
||
print(sys.argv[1] + "->" + sys.argv[3] + ":", in1[sys.argv[3]].shape) | ||
print(sys.argv[2] + "->" + sys.argv[3] + ":", in1[sys.argv[3]].shape) | ||
|
||
np.testing.assert_allclose(in1[sys.argv[3]], in2[sys.argv[3]], rtol=1e-5, atol=1e-5) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.