Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion projects/rocprofiler-systems/source/lib/core/argparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
_data.reg.processed_environs.emplace("sampling_gpus");
}

#if defined(ROCPROFSYS_BUILD_AINIC) && ROCPROFSYS_BUILD_AINIC == 1
if(_data.reg.environ_filter("ai-nics", _data))
{
_parser
Expand All @@ -975,8 +976,9 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
});

_data.reg.processed_environs.emplace("ai-nics");
_data.reg.processed_environs.emplace("sampling_ai-nics");
_data.reg.processed_environs.emplace("sampling_ainics");
}
#endif

_parser.start_group("GENERAL SAMPLING OPTIONS",
"General options for timer-based sampling per-thread");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,3 @@ target_link_libraries(
rocprofiler-systems::rocprofiler-systems-rocm
rocprofiler-systems::rocprofiler-systems-compile-definitions
)

if(ROCPROFSYS_BUILD_AINIC)
target_compile_definitions(pmc-gpu-collector-tests PUBLIC ROCPROFSYS_BUILD_AINIC=1)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ target_link_libraries(
rocprofiler-systems::rocprofiler-systems-interface-library
)

if(ROCPROFSYS_BUILD_AINIC)
target_compile_definitions(pmc-nic-collector-tests PUBLIC ROCPROFSYS_BUILD_AINIC=1)
endif()

target_include_directories(
pmc-nic-collector-tests
PRIVATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# include "library/pmc/device_providers/rocprofiler_sdk/provider.hpp"
#endif

#if defined(ROCPROFSYS_BUILD_AINIC)
#if defined(ROCPROFSYS_BUILD_AINIC) && ROCPROFSYS_BUILD_AINIC == 1
# include "library/pmc/collectors/nic/cache_policy.hpp"
# include "library/pmc/collectors/nic/collector.hpp"
#endif
Expand Down Expand Up @@ -94,7 +94,7 @@ struct gpu_production_config
using CacheApi = collectors::gpu::cache_policy;
};

#if defined(ROCPROFSYS_BUILD_AINIC)
#if defined(ROCPROFSYS_BUILD_AINIC) && ROCPROFSYS_BUILD_AINIC == 1
struct nic_production_config
{
using SettingsApi = collectors::settings_policy;
Expand Down Expand Up @@ -125,7 +125,7 @@ using gpu_perf_counter_collector_t =
collectors::gpu_perf_counter::collector<gpu_perf_counter_provider_t>;
#endif

#if defined(ROCPROFSYS_BUILD_AINIC)
#if defined(ROCPROFSYS_BUILD_AINIC) && ROCPROFSYS_BUILD_AINIC == 1
using nic_device_t = collectors::nic::device<amd_smi_device_t>;
using nic_collector_t =
collectors::nic::collector<provider_t, nic_device_t, nic_production_config>;
Expand Down Expand Up @@ -159,7 +159,7 @@ std::unique_ptr<gpu_collector_t> g_gpu_collector;
std::shared_ptr<gpu_perf_counter_provider_t> g_gpu_perf_counter_provider;
std::unique_ptr<gpu_perf_counter_collector_t> g_gpu_perf_counter_collector;
#endif
#if defined(ROCPROFSYS_BUILD_AINIC)
#if defined(ROCPROFSYS_BUILD_AINIC) && ROCPROFSYS_BUILD_AINIC == 1
std::unique_ptr<nic_collector_t> g_nic_collector;
#endif

Expand Down Expand Up @@ -333,12 +333,12 @@ setup()
g_device_provider = provider_factory_t::create();

g_gpu_collector = std::make_unique<gpu_collector_t>(g_device_provider);
#if defined(ROCPROFSYS_BUILD_AINIC)
#if defined(ROCPROFSYS_BUILD_AINIC) && ROCPROFSYS_BUILD_AINIC == 1
g_nic_collector = std::make_unique<nic_collector_t>(g_device_provider);
#endif

g_collector_slices.emplace_back(*g_gpu_collector);
#if defined(ROCPROFSYS_BUILD_AINIC)
#if defined(ROCPROFSYS_BUILD_AINIC) && ROCPROFSYS_BUILD_AINIC == 1
g_collector_slices.emplace_back(*g_nic_collector);
#endif
}
Expand Down Expand Up @@ -454,7 +454,7 @@ postfork_child_cleanup()
g_gpu_perf_counter_provider.reset();
#endif
g_gpu_collector.reset();
#if defined(ROCPROFSYS_BUILD_AINIC)
#if defined(ROCPROFSYS_BUILD_AINIC) && ROCPROFSYS_BUILD_AINIC == 1
g_nic_collector.reset();
#endif
#if defined(ROCPROFSYS_BUILD_HIPFILE)
Expand Down
19 changes: 0 additions & 19 deletions projects/rocprofiler-systems/tests/pytest/test_ainic.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,25 +148,6 @@ def test_settings_present(self, rocprof_config: RocprofsysConfig):
f"Missing: {missing}"
)

# No NIC hardware required; the module-level amdsmi_min_version("26.3") gate
# skips this on builds where AI NIC support is not compiled in.
@pytest.mark.parametrize("target", TARGETS)
@pytest.mark.timeout(30)
def test_sampling_ainics_help(self, target):
"""--sampling-ainics must appear in the sampling help output.

The flag is only registered (and therefore only shown by
``--help=sampling``) when the binary was built with
ROCPROFSYS_BUILD_AINIC=ON.
"""
result = self.run_test(
"baseline",
target=target,
run_args=["--help=sampling"],
fail_on_not_found=True,
)
self.assert_regex(result, pass_regex=[r"--sampling-ainics"])

@pytest.mark.ainic_required
@pytest.mark.network
@pytest.mark.rocpd("ainic_perf_env")
Expand Down
10 changes: 9 additions & 1 deletion projects/rocprofiler-systems/tests/pytest/test_cli_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ class TestCliHelp(RocprofsysTest):

@pytest.mark.parametrize("target", TARGETS)
@pytest.mark.parametrize("run_args, pass_regex", HELP_CASES)
def test(self, target, run_args, pass_regex):
def test(self, target, run_args, pass_regex, rocprof_config):
# Substitute the program name into name-dependent patterns.
pass_regex = [p.replace("{prog}", target) for p in pass_regex]

Expand All @@ -455,6 +455,14 @@ def test(self, target, run_args, pass_regex):
if target == "rocprof-sys-run" and run_args == ["--help=all"]:
pass_regex = pass_regex + [r"\[EXECUTION OPTIONS\]"]

# --ai-nics is only registered when built with ROCPROFSYS_BUILD_AINIC=1
# (requires AMD SMI >= 26.3 AND ROCPROFSYS_USE_AINIC=ON).
# On builds where AINIC was compiled out, silently drop the pattern so
# the rest of the domain/topic checks still run.
_amdsmi = rocprof_config.capabilities.amdsmi_version
if _amdsmi is None or _amdsmi < (26, 3):
pass_regex = [p for p in pass_regex if p != r"--ai-nics"]

result = self.run_test(
"baseline",
target=target,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ def test_cpus_without_host(self, target):
)
self.assert_regex(result, pass_regex=["ROCPROFSYS_SAMPLING_CPUS=0-3"])

@pytest.mark.amdsmi_min_version("26.3")
def test_ai_nics_without_device(self, target):
result = self.run_test(
"baseline",
Expand Down
Loading