Skip to content
This repository was archived by the owner on Apr 6, 2026. It is now read-only.

Commit 0b8c98c

Browse files
authored
Standardizing torch_binding.cpp and torch_binding.h in the doc (#138)
According to kernels here for example : https://huggingface.co/kernels-community/activation/tree/main/torch-ext, the binding files should be called : `torch_binding.xxx`. This pr simply standardises that in the doc
1 parent a78a83c commit 0b8c98c

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

docs/writing-kernels.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ relu
4343
├── relu_kernel
4444
│ └── relu.cu
4545
└── torch-ext
46-
└── torch_bindings.cpp
47-
└── torch_bindings.h
46+
└── torch_binding.cpp
47+
└── torch_binding.h
4848
└── relu
4949
└── __init__.py
5050
```
@@ -54,9 +54,9 @@ In this example we can find:
5454
- The build configuration in `build.toml`.
5555
- One or more top-level directories containing kernels (`relu_kernel`).
5656
- The `torch-ext` directory, which contains:
57-
- `torch_bindings.h`: contains declarations for kernel entry points
57+
- `torch_binding.h`: contains declarations for kernel entry points
5858
(from `kernel_a` and `kernel_b`).
59-
- `torch_bindings.cpp`: registers the entry points as Torch ops.
59+
- `torch_binding.cpp`: registers the entry points as Torch ops.
6060
- `torch_ext/relu`: contains any Python wrapping the kernel needs. At the
6161
bare minimum, it should contain an `__init__.py` file.
6262

@@ -139,11 +139,11 @@ for an example with multiple kernel sections.
139139

140140
Torch bindings are defined in C++, kernels commonly use two files:
141141

142-
- `torch_bindings.h` containing function declarations.
143-
- `torch_bindings.cpp` registering the functions as Torch ops.
142+
- `torch_binding.h` containing function declarations.
143+
- `torch_binding.cpp` registering the functions as Torch ops.
144144

145145
For instance, the `relu` kernel has the following declaration in
146-
`torch_bindings.h`:
146+
`torch_binding.h`:
147147

148148
```cpp
149149
#pragma once
@@ -190,7 +190,7 @@ void relu(torch::Tensor &out,
190190
}
191191
```
192192

193-
This function is then registered as a Torch op in `torch_bindings.cpp`:
193+
This function is then registered as a Torch op in `torch_binding.cpp`:
194194

195195
```cpp
196196
#include <torch/library.h>

0 commit comments

Comments
 (0)