-
Notifications
You must be signed in to change notification settings - Fork 4
Benchmark test nixlbench/kvcache #10
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
base: libfabric
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,7 +35,7 @@ class TrafficPattern: | |
| """ | ||
|
|
||
| matrix: np.ndarray | ||
| mem_type: Literal["cuda", "vram", "cpu", "dram"] | ||
| mem_type: Literal["cuda", "vram", "cpu", "dram","hpu"] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are we setting mem_type as hpu in any test/usecase ?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure. Currently it includes both cuda/cpu, so added hpu. KVBench i can't run it as it requires model support
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like it is not used. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove it then
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the test uses the mem_type == device in many places, so i will keep the hpu in mem_type similar to cuda |
||
| xfer_op: Literal["WRITE", "READ"] = "WRITE" | ||
| shards: int = 1 | ||
| dtype: torch.dtype = torch.int8 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,16 +103,87 @@ if cuda_available | |
| endif | ||
| endif | ||
|
|
||
| # SynapseAI (Habana Gaudi) dependency detection | ||
| synapse_inc_path = get_option('synapsepath_inc') | ||
| synapse_lib_path = get_option('synapsepath_lib') | ||
|
|
||
| if synapse_lib_path == '' | ||
| #use default path | ||
| # Try to find both libSynapse and hl-thunk libraries | ||
| synapse_lib = cpp.find_library('Synapse', | ||
| dirs: ['/usr/lib/habanalabs', '/usr/local/lib/habanalabs'], | ||
| required: false) | ||
| hlthunk_lib = cpp.find_library('hl-thunk', | ||
| dirs: ['/usr/lib/habanalabs', '/usr/local/lib/habanalabs'], | ||
| required: false) | ||
| else | ||
| synapse_lib = cpp.find_library('Synapse', | ||
| dirs: [synapse_lib_path], | ||
| required: false) | ||
| hlthunk_lib = cpp.find_library('hl-thunk', | ||
| dirs: [synapse_lib_path], | ||
| required: false) | ||
| endif | ||
|
|
||
| if synapse_inc_path == '' | ||
| #use default path | ||
| synapse_inc_path = '/usr/include/habanalabs/' | ||
| endif | ||
|
|
||
| # SynapseAI support requires both libraries | ||
| synapseai_dep = dependency('', required: false) # Initialize as not found | ||
| if synapse_lib.found() and hlthunk_lib.found() | ||
| synapseai_dep = declare_dependency(dependencies: [synapse_lib, hlthunk_lib]) | ||
| elif hlthunk_lib.found() | ||
| # Fallback to just hl-thunk if libSynapse not available | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this fallback ?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i have adopted it from the nixl meason file. |
||
| synapseai_dep = hlthunk_lib | ||
| endif | ||
|
|
||
| if synapseai_dep.found() | ||
| # Create proper dependency with include paths (including DRM path for habanalabs headers) | ||
| synapseai_dep = declare_dependency( | ||
| dependencies: synapseai_dep, | ||
| include_directories: [ | ||
| include_directories('/usr/include/drm'), | ||
| include_directories(synapse_inc_path) | ||
| ] | ||
| ) | ||
| message('Found SynapseAI support for Habana Gaudi devices') | ||
| synapseai_available = true | ||
| else | ||
| synapseai_available = false | ||
| warning('SynapseAI not found. Habana Gaudi device support will be disabled.') | ||
| endif | ||
|
|
||
| # GFlags | ||
| gflags_dep = dependency('gflags', required: true) | ||
|
|
||
| # OpenMP | ||
| openmp_dep = dependency('openmp', required: true) | ||
|
|
||
| # Check for etcd-cpp-api - use multiple methods for discovery | ||
| # Try pkg-config first | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ??
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. etcd it was not finding the path . so i have to add it to search in the default path |
||
| etcd_dep = dependency('etcd-cpp-api', required : false) | ||
| if not etcd_dep.found() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need this change ?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, otherwise it was never finding the etcd lib. |
||
| # Fallback: manual configuration | ||
| # message('etcd-cpp-api not found via pkg-config, using manual configuration') | ||
|
|
||
| # Check if we have the library files | ||
| etcd_lib = meson.get_compiler('cpp').find_library('etcd-cpp-api', | ||
| dirs: ['/usr/local/lib'], | ||
| required: false) | ||
|
|
||
| # Ensure etcd is available | ||
| if etcd_lib.found() | ||
| etcd_dep = declare_dependency( | ||
| include_directories: include_directories('/usr/local/include'), | ||
| dependencies: [etcd_lib], | ||
| # Add any required dependencies for etcd-cpp-api | ||
| link_args: [] # Add any additional link args if needed | ||
| ) | ||
| message('etcd-cpp-api found manually in /usr/local/lib') | ||
| else | ||
| etcd_dep = disabler() | ||
| message('etcd-cpp-api not found anywhere') | ||
| endif | ||
| endif | ||
| etcd_available = etcd_dep.found() | ||
| if etcd_available | ||
| add_project_arguments('-DHAVE_ETCD', language: 'cpp') | ||
|
|
@@ -148,7 +219,14 @@ if cuda_fabric_available | |
| add_project_arguments('-DHAVE_CUDA_FABRIC', language: 'cpp') | ||
| endif | ||
|
|
||
| if synapseai_available | ||
| add_project_arguments('-DHAVE_SYNAPSEAI', language: 'cpp') | ||
| endif | ||
|
|
||
| # Subprojects | ||
| if synapseai_available | ||
| subdir('src/synapseai') | ||
| endif | ||
| subdir('src/utils') | ||
| subdir('src/runtime') | ||
| subdir('src/worker') | ||
|
|
@@ -161,6 +239,7 @@ configure_file( | |
| 'HAVE_NVSHMEM': nvshmem_available ? '1' : '0', | ||
| 'HAVE_CUDA': cuda_available ? '1' : '0', | ||
| 'HAVE_CUDA_FABRIC': cuda_fabric_available ? '1' : '0', | ||
| 'HAVE_SYNAPSEAI': synapseai_available ? '1' : '0', | ||
| }, | ||
| install: true, | ||
| install_dir: get_option('includedir') / 'nixlbench' | ||
|
|
@@ -174,6 +253,11 @@ endif | |
| if cuda_available | ||
| deps += [cuda_dep] | ||
| endif | ||
|
|
||
| if synapseai_available | ||
| deps += [synapseai_dep] | ||
| message('add synapseai_dep') | ||
| endif | ||
| if nvshmem_available | ||
| deps += [nvshmem_lib] | ||
| args += [ | ||
|
|
@@ -185,9 +269,9 @@ if nvshmem_available | |
| ] | ||
| endif | ||
|
|
||
| if not etcd_available | ||
| error('No runtime available or not found') | ||
| endif | ||
| #if not etcd_available | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ??? |
||
| # error('No runtime available or not found') | ||
| #endif | ||
|
|
||
| if nvshmem_available | ||
| # Use nvcc directly for compilation and linking | ||
|
|
@@ -240,11 +324,21 @@ if nvshmem_available | |
| install_dir: get_option('bindir'), | ||
| depends: [nixlbench_runtimes, utils_lib, worker_libs]) | ||
| else | ||
| executable('nixlbench', 'src/main.cpp', | ||
| include_directories: inc_dir, | ||
| link_with: [nixlbench_runtimes, utils_lib, worker_libs], | ||
| dependencies: deps, | ||
| link_args: args, | ||
| install: true, | ||
| install_dir: get_option('bindir')) | ||
| if synapseai_available | ||
| executable('nixlbench', 'src/main.cpp', | ||
| include_directories: inc_dir, | ||
| link_with: [nixlbench_runtimes, utils_lib, worker_libs, synapseaiutils_lib], | ||
| dependencies: deps, | ||
| link_args: args, | ||
| install: true, | ||
| install_dir: get_option('bindir')) | ||
| else | ||
| executable('nixlbench', 'src/main.cpp', | ||
| include_directories: inc_dir, | ||
| link_with: [nixlbench_runtimes, utils_lib, worker_libs], | ||
| dependencies: deps, | ||
| link_args: args, | ||
| install: true, | ||
| install_dir: get_option('bindir')) | ||
| endif | ||
| endif | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed 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. | ||
|
|
||
| synapseaiutils_sources = [ | ||
| 'synapse_utils.cpp', | ||
| 'synapse_utils.h', | ||
| ] | ||
|
|
||
| synapseaiutils_deps = [ | ||
| synapseai_dep | ||
| ] | ||
|
|
||
| synapseaiutils_lib = static_library('synapseaiutils', | ||
| synapseaiutils_sources, | ||
| dependencies: synapseaiutils_deps, | ||
| include_directories: inc_dir | ||
| ) | ||
| synapseaiutils_dep = declare_dependency( | ||
| link_with: synapseaiutils_lib, | ||
| dependencies: synapseaiutils_deps, | ||
| include_directories: inc_dir | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to check for devices too as its an exported variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
next line has a device check - self.traffic_pattern.mem_type == "hpu"