Skip to content

fix: CUDA error 710 bugfix #1424

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

Merged
merged 1 commit into from
Nov 9, 2022
Merged
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
14 changes: 11 additions & 3 deletions core/partitioning/shape_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,24 @@ namespace partitioning {
at::Tensor generateSingleInput(ir::Input& input, c10::optional<at::ScalarType>& type_opt) {
auto cur_shape = input.input_shape;
std::vector<int64_t> shape;

// Initialize min and max ranges for random number selection
int LoValIncl = 0;
int HiValExcl = 2;

shape.insert(shape.begin(), std::begin(cur_shape.d), std::begin(cur_shape.d) + cur_shape.nbDims);
// auto type_opt = types[input.first][i];

auto type = at::kFloat;
if (type_opt) {
type = type_opt.value();
} else {
LOG_WARNING("Input type for doing shape analysis could not be determined, defaulting to F32");
}
auto in = at::randint(5, shape, {at::kCUDA}).to(type);
// ivalue_map[input.first] = in.clone();

// Make the value range for input tensor a uniform (float) distribution
// over [LoValIncl, HiValExcl), then cast to the desired dtype
auto in = ((HiValExcl - LoValIncl) * at::rand(shape, {at::kCUDA}) + LoValIncl).to(type);
Copy link
Collaborator Author

@gs-olive gs-olive Nov 3, 2022

Choose a reason for hiding this comment

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

Used float inputs in the range $[LoValIncl, HiValExcl)$, then casted to the desired type to avoid divide-by-zero errors potentially arising from only selecting integer random values (even for float tensors). Currently, $LoValIncl = 0$ and $HiValExcl = 2$, but this will be made optionally user-customizeable in a later PR, as discussed in RFC #1425.

Copy link
Collaborator

Choose a reason for hiding this comment

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

seems like a little bit hard-coded for this model only, but will be resolved once the input range is open to users by this RFC #1425.


return in;
}

Expand Down