未验证 提交 34d7d6ae 编写于 作者: 石晓伟 提交者: GitHub

declare the stream::Priority as enum class, test=develop (#24013)

上级 96491e43
......@@ -234,7 +234,7 @@ void CUDAContext::InitEigenContext() {
}
CUDAContext::CUDAContext(const CUDAPlace& place,
const enum stream::Priority& priority) {
const stream::Priority& priority) {
place_ = place;
CUDADeviceGuard guard(place_.device);
stream_.reset(new stream::CUDAStream(place, priority));
......
......@@ -85,7 +85,7 @@ class CUDAContext {
CUDAContext() = default;
explicit CUDAContext(
const CUDAPlace& place,
const enum stream::Priority& priority = stream::Priority::kNormal);
const stream::Priority& priority = stream::Priority::kNormal);
~CUDAContext();
......@@ -274,11 +274,11 @@ class CUDADeviceContext : public DeviceContext {
return context()->Stream()->WaitCallback();
}
void ResetDefaultContext(const enum stream::Priority& priority) {
void ResetDefaultContext(const stream::Priority& priority) {
default_ctx_.reset(new CUDAContext(place_, priority));
}
void ResetThreadContext(const enum stream::Priority& priority) {
void ResetThreadContext(const stream::Priority& priority) {
std::lock_guard<std::mutex> guard(ctx_mtx_);
thread_ctx_[this].reset(new CUDAContext(place_, priority));
}
......
......@@ -22,7 +22,7 @@ namespace stream {
constexpr unsigned int kDefaultFlag = cudaStreamDefault;
bool CUDAStream::Init(const Place& place, const enum Priority& priority) {
bool CUDAStream::Init(const Place& place, const Priority& priority) {
PADDLE_ENFORCE_EQ(is_gpu_place(place), true,
platform::errors::InvalidArgument(
"Cuda stream must be created using cuda place."));
......
......@@ -36,14 +36,13 @@ enum class Priority : uint8_t {
class CUDAStream final {
public:
CUDAStream() = default;
CUDAStream(const Place& place,
const enum Priority& priority = Priority::kNormal) {
explicit CUDAStream(const Place& place,
const Priority& priority = Priority::kNormal) {
Init(place, priority);
}
virtual ~CUDAStream() { Destroy(); }
bool Init(const Place& place,
const enum Priority& priority = Priority::kNormal);
bool Init(const Place& place, const Priority& priority = Priority::kNormal);
template <typename Callback>
void AddCallback(Callback&& callback) const {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册