NVIDIA / NVIDIA/nvbench

Enable specifying type axes name together with type list

Open
#40 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P2: nice to have type: enhancement
Dominant language
Cuda
Stars
927
Forks
123
Avg merge
2d 10h
Merged PRs (30d)
2

Description

Problem

Today, I can provide a meaningful name for a type axes using the set_type_axes_names function.

For example,

using ctcs_types = nvbench::type_list<nvbench::int8_t,
                                      nvbench::int16_t,
                                      nvbench::int32_t,
                                      nvbench::float32_t,
                                      nvbench::int64_t,
                                      nvbench::float64_t>;
NVBENCH_BENCH_TYPES(copy_type_conversion_sweep,   NVBENCH_TYPE_AXES(ctcs_types, ctcs_types))
  .set_type_axes_names({"In", "Out"});

However, setting the names out-of-band like this makes it easy to have mismatches in either the number of arguments or which type a name corresponds to. This is especially likely to occur when copy/pasting an example or existing benchmark and modifying it.

As it happens, a mismatch in the number of arguments currently causes a segfault (which lead me to open this issue in the first place).

Proposed Solution

It would be nice to be able to provide a name for a type list/axes inline.

This could be done a few ways. One way would be to add something like a named_type_list:

struct my_named_type_list{
   static constexpr auto = "My type list name";
   using types = nvbench::type_list<nvbench::int8_t, nvbench::int16_t>;
};

NVBENCH_BENCH_TYPES(copy_type_conversion_sweep,  NVBENCH_TYPE_AXES(my_named_type_list) )

This could be inconvenient if you want to use the same type list for multiple axes with different names (as in the example above), so another option would be specifying the name along with the list:

NVBENCH_BENCH_TYPES(copy_type_conversion_sweep,   NVBENCH_TYPE_AXES({"In", ctcs_types}, {"Out", ctcs_types}));

There's a bunch of different ways this could be accomplished and am open to suggestions. The main idea is to prevent mismatch between names/type axes by allowing defining the name and type list together instead of separately.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining the set_type_axes_names function and the NVBENCH_TYPE_AXES and NVBENCH_BENCH_TYPES entry points shown in the issue. Define and implement a decided API for coupling each type-axis name with its type list, then verify that mismatched names and axes can no longer cause the reported failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
performance, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.