pytorch/test/inductor/cpp/test_cpp_prefix.cpp
Jason Ansel c7c09722ad Move TorchDynamo into PyTorch core (#86461)
Context:
https://github.com/pytorch/torchdynamo/issues/1588

This PR moves [TorchDynamo](https://github.com/pytorch/torchdynamo) and TorchInductor into PyTorch core.
- `torchdynamo` becomes `torch._dynamo`
- `torchinductor` becomes `torch._inductor`

This PR was generated by running `copy_to_core.sh` in https://github.com/pytorch/torchdynamo/pull/1538

Pull Request resolved: https://github.com/pytorch/pytorch/pull/86461
Approved by: https://github.com/voznesenskym
2022-10-13 23:18:06 +00:00

22 lines
415 B
C++

#include "../../torchinductor/codegen/cpp_prefix.h"
#include <gtest/gtest.h>
TEST(testCppPrefix, testAtomicAddInt) {
int x = 0;
atomic_add(&x, 100);
EXPECT_EQ(x, 100);
}
TEST(testCppPrefix, testAtomicAddFloat) {
float x = 0.0f;
atomic_add(&x, 100.0f);
EXPECT_EQ(x, 100.0f);
}
TEST(testCppPrefix, testAtomicAddI64) {
int64_t x = 0.0;
int64_t y = 100.0;
atomic_add(&x, y);
EXPECT_EQ(x, 100);
}