Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev eliminate gcc warnings #6199

Merged
merged 6 commits into from
Sep 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ Maybe<void> CheckSymmetricNdSbpBoxing(Symbol<PlacedNdSbp> in, Symbol<PlacedNdSbp

Maybe<one::Tensor> SymmetricNdSbpBoxing(const std::shared_ptr<one::Tensor>& input,
Symbol<PlacedNdSbp> in, Symbol<PlacedNdSbp> out) {
const auto& in_nd_sbp = in->nd_sbp();
const auto& out_nd_sbp = out->nd_sbp();
const auto& in_parallel_desc = in->placement();
const auto& out_parallel_desc = out->placement();
Expand Down
2 changes: 1 addition & 1 deletion oneflow/core/job/session_global_objects_scope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ AvailableMemDesc GetDryRunAvailableMemDesc() {

AvailableMemDesc ret;
AvailableMemDescOfMachine machine_amd_i;
for (int64_t i : Global<ResourceDesc, ForSession>::Get()->process_ranks()) {
for (int64_t i = 0; i < Global<ResourceDesc, ForSession>::Get()->process_ranks().size(); ++i) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这两个不一定等价?

*ret.add_machine_amd() = this_machine_mem_desc;
}
return ret;
Expand Down
4 changes: 2 additions & 2 deletions oneflow/user/kernels/nvtx_range_kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class NvtxStartKernel final : public user_op::OpKernel {
private:
using user_op::OpKernel::Compute;
void Compute(user_op::KernelComputeContext* ctx, user_op::OpKernelState* state) const override {
auto* kernel_state = dynamic_cast<NvtxOpKernelState*>(state);
const user_op::Tensor* in = ctx->Tensor4ArgNameAndIndex("in", 0);
user_op::Tensor* out = ctx->Tensor4ArgNameAndIndex("out", 0);
const ShapeView& in_shape = in->shape();
Expand All @@ -69,6 +68,7 @@ class NvtxStartKernel final : public user_op::OpKernel {
Memcpy<DeviceType::kGPU>(ctx->device_ctx(), out->mut_dptr<void>(), in->dptr<void>(),
in_shape.elem_cnt() * GetSizeOfDataType(in_data_type));
#ifdef OF_ENABLE_PROFILER
auto* kernel_state = dynamic_cast<NvtxOpKernelState*>(state);
const std::string mark_prefix = ctx->Attr<std::string>("mark_prefix");
const std::string mark = mark_prefix + "-" + std::to_string(kernel_state->counter());
nvtxRangeId_t range_id = nvtxRangeStartA(mark.c_str());
Expand Down Expand Up @@ -101,14 +101,14 @@ class NvtxEndKernel final : public user_op::OpKernel {
private:
using user_op::OpKernel::Compute;
void Compute(user_op::KernelComputeContext* ctx, user_op::OpKernelState* state) const override {
auto* kernel_state = dynamic_cast<NvtxOpKernelState*>(state);
const user_op::Tensor* in = ctx->Tensor4ArgNameAndIndex("in", 0);
user_op::Tensor* out = ctx->Tensor4ArgNameAndIndex("out", 0);
const ShapeView& in_shape = in->shape();
CHECK_EQ(out->shape(), in_shape);
const DataType in_data_type = in->data_type();
CHECK_EQ(out->data_type(), in_data_type);
#ifdef OF_ENABLE_PROFILER
auto* kernel_state = dynamic_cast<NvtxOpKernelState*>(state);
const std::string mark_prefix = ctx->Attr<std::string>("mark_prefix");
const std::string mark = mark_prefix + "-" + std::to_string(kernel_state->counter());
auto it = mark2range_id.find(mark.c_str());
Expand Down
1 change: 0 additions & 1 deletion oneflow/user/ops/narrow_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ REGISTER_USER_OP("narrow")
.SetGetSbpFn([](user_op::SbpContext* ctx) -> Maybe<void> {
const user_op::TensorDesc& in_tensor = ctx->LogicalTensorDesc4InputArgNameAndIndex("in", 0);
const int64_t& dim = ctx->Attr<int64_t>("dim");
const int64_t& start = ctx->Attr<int64_t>("start");
const int64_t& length = ctx->Attr<int64_t>("length");
FOR_RANGE(int64_t, i, 0, in_tensor.shape().NumAxes()) {
if (i != dim) {
Expand Down
2 changes: 0 additions & 2 deletions oneflow/user/ops/prelu_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ REGISTER_USER_OP("prelu_grad")
})
.SetGetSbpFn([](user_op::SbpContext* ctx) -> Maybe<void> {
const user_op::TensorDesc& x_tensor = ctx->LogicalTensorDesc4InputArgNameAndIndex("x", 0);
const user_op::TensorDesc& alpha_tensor =
ctx->LogicalTensorDesc4InputArgNameAndIndex("alpha", 0);
ctx->NewBuilder()
.Split(user_op::OpArg("dy", 0), 0)
.Split(user_op::OpArg("x", 0), 0)
Expand Down