Skip to content

Commit a736b99

Browse files
albanDfacebook-github-bot
authored andcommitted
Remove old section of the aten doc that is not true anymore (#35807)
Summary: Pull Request resolved: #35807 Differential Revision: D20794708 Pulled By: albanD fbshipit-source-id: 8e67c369bd17f6527dd024c89fd2481ecd7f6ee1
1 parent 945d7a7 commit a736b99

1 file changed

Lines changed: 0 additions & 35 deletions

File tree

aten/src/README.md

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -106,38 +106,3 @@ function call, e.g., `kernel = THTensor_(newContiguous2D)(k_)`.
106106
to call `THError` before performing any allocations, since in some cases we
107107
sketchily throw a C++ exception and try to recover (in particular, the test
108108
suite does this.)
109-
110-
## The C interface
111-
112-
Historically, the Torch libraries were implemented in C. Since then, we have slowly
113-
started rewriting bits of pieces of Torch in C++ (usually because there is some
114-
C++ feature which would be really helpful for writing something.) However,
115-
Torch has *always been*, and *will always be* a library that provides a C ABI
116-
interface, even if, at some point in the future, its internal implementation
117-
is entirely done in a C++ library that heavily uses C++ idioms. (At the moment,
118-
all of the source files are C++, but they are mostly C code that happens to be
119-
compiled as C++).
120-
121-
In order to achieve this, the `TH_API` macro (called `THC_API` in `THC`) plays
122-
a crucial role: it declares a function as having C-linkage, which means that the
123-
C++ compiler doesn't mangle its name and a C client can link against it.
124-
125-
As a developer, here is what you need to know:
126-
127-
1. If you add a function to the public API of Torch, you *must* mark it with
128-
`TH_API` or `THC_API` (depending if you are in CPU or CUDA land).
129-
This will ensure it is built with C-linkage (and on Windows, it
130-
will also ensure that the symbol is exported from the DLL; otherwise it
131-
won't be visible.)
132-
133-
2. C++ features should ONLY be used in `.cpp` and `.hpp` files, and not in
134-
`.h` files. If you need to use a C++ type in a header file, you should
135-
define this in a separate, C++ only header `.hpp`, and declare it opaquely
136-
in the `.h`. Search for `mutex` for an example of this principle being applied.
137-
(This convention is OPPOSITE from the prevailing convention in PyTorch and
138-
ATen, where C++ headers are defined in `.h` files.)
139-
140-
Arguably, the "C-compatible" headers should live in a separate directory,
141-
distinct from the C++ code. We think this might be a good thing to do
142-
eventually, and would make the code structure more clear, but we have not
143-
done it at the moment.

0 commit comments

Comments
 (0)