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

[PATCH v4] test: ml_perf: add ML performance test #2138

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JereLeppanen
Copy link
Collaborator

No description provided.

@odpbuild odpbuild changed the title test: ml_perf: add ML performance test [PATCH v1] test: ml_perf: add ML performance test Oct 25, 2024
test/performance/odp_ml_perf.c Outdated Show resolved Hide resolved
test/performance/odp_ml_perf.c Show resolved Hide resolved
}
}

optind = 1; /* reset 'extern optind' from the getopt lib */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some ODP testers has this and some don't, does this have any actual effect?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only if getopt*() is called again, I guess. So at least in this case, no effect. Left it there anyway. Maybe we should clean these up at some point.

};

typedef struct {
int mode, num_threads, rounds, latency, warmup;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These as well as num_batch could be unsigned integers as them having a negative value does not make much sense.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't do any harm, either. The negative range is not used now, but it could be used at some point for some special values, etc. I didn't change these now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, user can pass e.g. negative round and warmup values and tester happily continues, giving weird results. There should at least be some sanity checks after parsing the command line.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a typical user of this tool, I don't need such checks. As a developer, I think if we want to do user input sanitation (and I don't), then we should probably implement it in a library and do it consistently in all of our testing tools, etc.

test/performance/odp_ml_perf.c Outdated Show resolved Hide resolved
test/performance/odp_ml_perf.c Outdated Show resolved Hide resolved
Comment on lines +583 to +576
if (out_size_final != glb->ref_file_size) {
ODPH_ERR("Output size mismatch: %" PRIu64
" differs from reference file size %" PRIu64 "\n",
out_size_final, glb->ref_file_size);
ret = -1;
goto error;
}

if (memcmp(glb->ref_file_data, output_final, out_size_final)) {
ODPH_ERR("Output differs from reference\n");
ret = -1;
goto error;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's need to fail the thread due to these, this could simply be made visible when printing results at the end.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least I would definitely want the program to exit with an error if the output doesn't match the reference because in that case something went horribly wrong. Also in CI we want an error exit in that case.

Comment on lines +624 to +616
mdl = odp_ml_model_create(glb->opt.model_name, &model_param);
if (mdl == ODP_ML_MODEL_INVALID) {
ODPH_ERR("odp_ml_model_create() failed\n");
ret = -1;
goto error;
}

if (odp_ml_model_destroy(mdl)) {
ODPH_ERR("odp_ml_model_destroy() failed\n");
ret = -1;
goto error;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For stuff that's being tested, it's probably better to record their failures as some error counter increases instead of failing the thread. Same thing for loading and unloading in test_ml_load().

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, better to just quit. We're measuring speed, not e.g. the probability of success.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, in a performance testing setting, speed and probability of success might be related. Anyways, up to you.

test/performance/odp_ml_perf.c Show resolved Hide resolved
test/performance/odp_ml_perf.c Show resolved Hide resolved
@odpbuild odpbuild changed the title [PATCH v1] test: ml_perf: add ML performance test [PATCH v2] test: ml_perf: add ML performance test Nov 13, 2024
@JereLeppanen
Copy link
Collaborator Author

v2: All comments processed.

@odpbuild odpbuild changed the title [PATCH v2] test: ml_perf: add ML performance test [PATCH v3] test: ml_perf: add ML performance test Nov 22, 2024
@odpbuild odpbuild changed the title [PATCH v3] test: ml_perf: add ML performance test [PATCH v4] test: ml_perf: add ML performance test Nov 22, 2024
Add machine learning (ML) performance test application. The
application measures nanoseconds used for various ML operations, such
as creating and desroying a model, loading and unloading a model, and
inferencing.

Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Add ML performance test run for linux-gen. This runs some basic
performance tests using the conv.onnx model.

Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants