[EP Perf] Add tag to indicate which TRT parser is using (#19784)

### Description
* Add tag to distinguish if TRT `builtin` or `oss` parser is being used
* `oss` tag will be inserted with onnx-tensorrt commit id, to indicate
which version oss parser is
### Validate
DB entry before/after this PR 
(during test, `builtin` or `oss_{commit_id}` tag was inserted in the
database entries):

### Motivation and Context
To distinguish perf results using builtin/oss parser in the database,
this parser tag is needed.
In future, results using different parsers will be listed in different
Perf Dashboard pages.
This commit is contained in:
Yifan Li 2024-03-08 10:24:36 -08:00 committed by GitHub
parent 01c376a0b9
commit 3170a48e60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 4 deletions

View file

@ -56,6 +56,7 @@ def parse_arguments():
parser.add_argument("-b", "--branch", help="Branch", required=True)
parser.add_argument("--kusto_conn", help="Kusto connection URL", required=True)
parser.add_argument("--database", help="Database name", required=True)
parser.add_argument("--use_tensorrt_oss_parser", help="Use TensorRT OSS parser", required=False)
parser.add_argument(
"-d",
"--commit_datetime",
@ -370,7 +371,7 @@ def write_table(
ingest_client.ingest_from_dataframe(table, ingestion_properties=ingestion_props)
def get_identifier(commit_datetime, commit_hash, trt_version, branch):
def get_identifier(commit_datetime, commit_hash, trt_version, branch, use_tensorrt_oss_parser):
"""
Returns an identifier that associates uploaded data with an ORT commit/date/branch and a TensorRT version.
@ -383,7 +384,23 @@ def get_identifier(commit_datetime, commit_hash, trt_version, branch):
"""
date = str(commit_datetime.date()) # extract date only
return date + "_" + commit_hash + "_" + trt_version + "_" + branch
if use_tensorrt_oss_parser:
current_dir = os.path.dirname(os.path.abspath(__file__))
root_dir = os.path.abspath(os.path.join(current_dir, "../../../../.."))
deps_txt_path = os.path.join(root_dir, "cmake", "deps.txt")
commit_head = ""
with open(deps_txt_path) as file:
for line in file:
parts = line.split(";")
if parts[0] == "onnx_tensorrt":
url = parts[1]
commit = url.split("/")[-1]
commit_head = commit[:6]
break
parser = f"oss_{commit_head}"
else:
parser = "builtin"
return "_".join([date, commit_hash, trt_version, parser, branch])
def main():
@ -396,7 +413,9 @@ def main():
# connect to database
kcsb_ingest = KustoConnectionStringBuilder.with_az_cli_authentication(args.kusto_conn)
ingest_client = QueuedIngestClient(kcsb_ingest)
identifier = get_identifier(args.commit_datetime, args.commit_hash, args.trt_version, args.branch)
identifier = get_identifier(
args.commit_datetime, args.commit_hash, args.trt_version, args.branch, args.use_tensorrt_oss_parser
)
upload_time = datetime.datetime.now(tz=datetime.timezone.utc).replace(microsecond=0)
try:

View file

@ -76,6 +76,10 @@ jobs:
- name: image
value: ort-image-$(Build.BuildId)
- name: parser
${{ if eq(parameters.UseTensorrtOssParser, true) }}:
value: --use_tensorrt_oss_parser $(parameters.UseTensorrtOssParser) }}
steps:
- ${{ if and(eq(parameters.TrtVersion, 'BIN'), eq(parameters.UseTensorrtOssParser, false)) }}:
@ -155,7 +159,7 @@ jobs:
inlineScript: |
short_hash=$(git rev-parse --short HEAD) &&
commit_date=$(git log -1 --date=iso-strict --pretty=format:%cd) &&
python3 $(Build.SourcesDirectory)/onnxruntime/python/tools/tensorrt/perf/post.py -r $(Build.SourcesDirectory)/Artifact/result -c $short_hash -d $commit_date -u "$(reportUrl)?buildId=$(Build.BuildId)" -t $(trtVersion) -b $(branchName) --kusto_conn $(kustoConn) --database $(database)
python3 $(Build.SourcesDirectory)/onnxruntime/python/tools/tensorrt/perf/post.py -r $(Build.SourcesDirectory)/Artifact/result -c $short_hash -d $commit_date -u "$(reportUrl)?buildId=$(Build.BuildId)" -t $(trtVersion) -b $(branchName) --kusto_conn $(kustoConn) --database $(database) $(parser)
- template: templates/component-governance-component-detection-steps.yml
parameters :