summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/python-pytorch-for-r-torch-without-kineto.patch
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2025-11-07 17:45:02 +0100
committerRicardo Wurmus <rekado@elephly.net>2025-11-07 21:52:07 +0100
commit02f59daf078af5b54c020a04a4db9b02253e2f64 (patch)
treec028955990fd519bdb3709bc5a9a82f10860945c /gnu/packages/patches/python-pytorch-for-r-torch-without-kineto.patch
parent0f2df2dad59e2f5e6da6144b009184a7f26e33b0 (diff)
gnu: python-pytorch-for-r-torch: Update to 2.7.1.
* gnu/packages/patches/python-pytorch-for-r-torch-fix-codegen.patch, gnu/packages/patches/python-pytorch-for-r-torch-system-libraries.patch: Update. * gnu/packages/patches/python-pytorch-for-r-torch-without-kineto.patch: New file. * gnu/local.mk (dist_patch_DATA): Record it. * gnu/packages/machine-learning.scm (python-pytorch-for-r-torch): Update to 2.7.1. [source]: Use new patch. [arguments]: Remove phase 'fix-aten-vec; copy and adjust 'use-system-libraries phase from python-pytorch. [inputs]: Inherit all from python-pytorch; replace gloo with gloo-for-r-torch. [native-inputs]: Inherit all from python-pytorch. [propagated-inputs]: Inherit all from python-pytorch. Change-Id: Ib2cf511fc34f609bbc7e92971720b00c4523419f
Diffstat (limited to 'gnu/packages/patches/python-pytorch-for-r-torch-without-kineto.patch')
-rw-r--r--gnu/packages/patches/python-pytorch-for-r-torch-without-kineto.patch64
1 files changed, 64 insertions, 0 deletions
diff --git a/gnu/packages/patches/python-pytorch-for-r-torch-without-kineto.patch b/gnu/packages/patches/python-pytorch-for-r-torch-without-kineto.patch
new file mode 100644
index 00000000000..1b10f18d5a6
--- /dev/null
+++ b/gnu/packages/patches/python-pytorch-for-r-torch-without-kineto.patch
@@ -0,0 +1,64 @@
+Even when building without Kineto, the <ActivityType.h> header is still
+imported and the ActivityType type is used. This patch was copied from
+https://github.com/pytorch/pytorch/pull/111048 and adapted.
+
+diff --git a/torch/csrc/profiler/kineto_shim.h b/torch/csrc/profiler/kineto_shim.h
+index c4efd7785..2caef1f1e 100644
+--- a/torch/csrc/profiler/kineto_shim.h
++++ b/torch/csrc/profiler/kineto_shim.h
+@@ -12,7 +12,55 @@
+ #undef USE_KINETO
+ #endif
+
++#ifdef USE_KINETO
+ #include <ActivityType.h>
++#else
++namespace libkineto {
++// copied from header
++/*
++ * Copyright (c) Meta Platforms, Inc. and affiliates.
++ * All rights reserved.
++ *
++ * This source code is licensed under the BSD-style license found in the
++ * LICENSE file in the root directory of this source tree.
++ */
++
++// Note : All activity types are not enabled by default. Please add them
++// at correct position in the enum
++enum class ActivityType {
++ // Activity types enabled by default
++ CPU_OP = 0, // cpu side ops
++ USER_ANNOTATION,
++ GPU_USER_ANNOTATION,
++ GPU_MEMCPY,
++ GPU_MEMSET,
++ CONCURRENT_KERNEL, // on-device kernels
++ EXTERNAL_CORRELATION,
++ CUDA_RUNTIME, // host side cuda runtime events
++ CUDA_DRIVER, // host side cuda driver events
++ CPU_INSTANT_EVENT, // host side point-like events
++ PYTHON_FUNCTION,
++ OVERHEAD, // CUPTI induced overhead events sampled from its overhead API.
++
++ // Optional Activity types
++ CUDA_SYNC, // synchronization events between runtime and kernels
++ GLOW_RUNTIME, // host side glow runtime events
++ MTIA_RUNTIME, // host side MTIA runtime events
++ CUDA_PROFILER_RANGE, // CUPTI Profiler range for performance metrics
++ MTIA_CCP_EVENTS, // MTIA ondevice CCP events
++ HPU_OP, // HPU host side runtime event
++ XPU_RUNTIME, // host side xpu runtime events
++ MTIA_WORKLOADD,
++
++ PRIVATEUSE1_RUNTIME,
++ PRIVATEUSE1_DRIVER,
++
++ ENUM_COUNT, // This is to add buffer and not used for any profiling logic. Add your new type before it.
++ OPTIONAL_ACTIVITY_TYPE_START = CUDA_SYNC,
++};
++}
++
++#endif
+
+ #include <torch/csrc/Export.h>
+ #include <torch/csrc/profiler/api.h>