-
Notifications
You must be signed in to change notification settings - Fork 86
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
[ASPLOS] Add torch to lit cfg for programming_examples #1371
Conversation
Coverage ReportCreated: 2024-04-22 18:19Click here for information about interpreting this report.
Generated by llvm-cov -- llvm version 14.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
black
programming_examples/ml/resnet/layers_conv2_x/test.py|63|
programming_examples/ml/resnet/layers_conv2_x/test.py|154|
programming_examples/ml/resnet/layers_conv2_x/test.py|170|
programming_examples/ml/resnet/layers_conv2_x/test.py|185|
programming_examples/ml/resnet/layers_conv2_x/test.py|200|
programming_examples/ml/resnet/layers_conv2_x/test.py|212|
programming_examples/ml/resnet/layers_conv2_x/test.py|247|
programming_examples/ml/resnet/layers_conv2_x/test.py|279|
programming_examples/ml/resnet/layers_conv2_x/test.py|281|
programming_examples/ml/resnet/layers_conv2_x/test.py|314|
programming_examples/ml/resnet/layers_conv2_x/test.py|324|
programming_examples/ml/resnet/layers_conv2_x/test.py|350|
programming_examples/ml/resnet/layers_conv2_x/test.py|410|
programming_examples/ml/resnet/layers_conv2_x/test.py|422|
programming_examples/ml/resnet/layers_conv2_x/test.py|439 col 1|
@@ -14,177 +14,183 @@ | |||
import os | |||
import numpy as np | |||
from aie.utils.xrt import setup_aie, extract_trace, write_out_trace, execute | |||
|
|||
import aie.utils.test as test_utils | |||
torch.use_deterministic_algorithms(True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
torch.use_deterministic_algorithms(True) | |
torch.use_deterministic_algorithms(True) |
) | ||
|
||
print("\nPASS!\n") | ||
def main(opts): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
def main(opts): | |
def main(opts): |
trace_size=trace_size, | ||
) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
torch.round(self.relu2(conv2_out) / inp_scale3), min, max | ||
) | ||
conv3_out = self.conv3(relu2_out) * inp_scale3 * weight_scale3 | ||
same_scale_init = torch.clamp(torch.round(conv3_out / inp_scale1), -128, 127) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
same_scale_init = torch.clamp(torch.round(conv3_out / inp_scale1), -128, 127) | |
same_scale_init = torch.clamp( | |
torch.round(conv3_out / inp_scale1), -128, 127 | |
) |
) | ||
return final_out | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
block_2_final_out = block_2_relu_3 * ( | ||
torch.clamp( | ||
torch.round(self.block_2_relu3(block_2_skip_add) / block_2_relu_3), | ||
def main(opts): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
def main(opts): | |
def main(opts): |
block_0_int_weight_3 = torch.randint(10, 20, (256, 64, 1, 1)).type(torch.FloatTensor) | ||
block_0_int_weight_skip = torch.randint(10, 20, (256, 64, 1, 1)).type(torch.FloatTensor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
block_0_int_weight_3 = torch.randint(10, 20, (256, 64, 1, 1)).type(torch.FloatTensor) | |
block_0_int_weight_skip = torch.randint(10, 20, (256, 64, 1, 1)).type(torch.FloatTensor) | |
block_0_int_weight_3 = torch.randint(10, 20, (256, 64, 1, 1)).type( | |
torch.FloatTensor | |
) | |
block_0_int_weight_skip = torch.randint(10, 20, (256, 64, 1, 1)).type( | |
torch.FloatTensor | |
) |
block_0_int_weight_3 = torch.randint(10, 20, (256, 64, 1, 1)).type(torch.FloatTensor) | ||
block_0_int_weight_skip = torch.randint(10, 20, (256, 64, 1, 1)).type(torch.FloatTensor) | ||
|
||
block_1_int_weight_1 = torch.randint(20, 30, (64, 256, 1, 1)).type(torch.FloatTensor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
block_1_int_weight_1 = torch.randint(20, 30, (64, 256, 1, 1)).type(torch.FloatTensor) | |
block_1_int_weight_1 = torch.randint(20, 30, (64, 256, 1, 1)).type( | |
torch.FloatTensor | |
) |
|
||
block_1_int_weight_1 = torch.randint(20, 30, (64, 256, 1, 1)).type(torch.FloatTensor) | ||
block_1_int_weight_2 = torch.randint(20, 30, (64, 64, 3, 3)).type(torch.FloatTensor) | ||
block_1_int_weight_3 = torch.randint(20, 30, (256, 64, 1, 1)).type(torch.FloatTensor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
block_1_int_weight_3 = torch.randint(20, 30, (256, 64, 1, 1)).type(torch.FloatTensor) | |
block_1_int_weight_3 = torch.randint(20, 30, (256, 64, 1, 1)).type( | |
torch.FloatTensor | |
) |
block_1_int_weight_2 = torch.randint(20, 30, (64, 64, 3, 3)).type(torch.FloatTensor) | ||
block_1_int_weight_3 = torch.randint(20, 30, (256, 64, 1, 1)).type(torch.FloatTensor) | ||
|
||
block_2_int_weight_1 = torch.randint(30, 40, (64, 256, 1, 1)).type(torch.FloatTensor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
block_2_int_weight_1 = torch.randint(30, 40, (64, 256, 1, 1)).type(torch.FloatTensor) | |
block_2_int_weight_1 = torch.randint(30, 40, (64, 256, 1, 1)).type( | |
torch.FloatTensor | |
) |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
torch.FloatTensor | ||
) | ||
block_2_int_weight_2 = torch.randint(30, 40, (64, 64, 3, 3)).type(torch.FloatTensor) | ||
block_2_int_weight_3 = torch.randint(30, 40, (256, 64, 1, 1)).type(torch.FloatTensor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
block_2_int_weight_3 = torch.randint(30, 40, (256, 64, 1, 1)).type(torch.FloatTensor) | |
block_2_int_weight_3 = torch.randint(30, 40, (256, 64, 1, 1)).type( | |
torch.FloatTensor | |
) |
trace_size=trace_size, | ||
) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
# Bottleneck 0 | ||
self.block_0_conv1 = nn.Conv2d(in_planes, planes, kernel_size=1, bias=False) | ||
self.block_0_conv2 = nn.Conv2d( | ||
planes, planes, kernel_size=3, padding=1, padding_mode="zeros", bias=False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
planes, planes, kernel_size=3, padding=1, padding_mode="zeros", bias=False | |
planes, | |
planes, | |
kernel_size=3, | |
padding=1, | |
padding_mode="zeros", | |
bias=False, |
self.expansion * planes, planes, kernel_size=1, bias=False | ||
) | ||
self.block_1_conv2 = nn.Conv2d( | ||
planes, planes, kernel_size=3, padding=1, padding_mode="zeros", bias=False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
planes, planes, kernel_size=3, padding=1, padding_mode="zeros", bias=False | |
planes, | |
planes, | |
kernel_size=3, | |
padding=1, | |
padding_mode="zeros", | |
bias=False, |
self.expansion * planes, planes, kernel_size=1, bias=False | ||
) | ||
self.block_2_conv2 = nn.Conv2d( | ||
planes, planes, kernel_size=3, padding=1, padding_mode="zeros", bias=False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
planes, planes, kernel_size=3, padding=1, padding_mode="zeros", bias=False | |
planes, | |
planes, | |
kernel_size=3, | |
padding=1, | |
padding_mode="zeros", | |
bias=False, |
) | ||
return block_2_final_out | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
# ------------------------------------------------------ | ||
ds = DataShaper() | ||
before_input = int_inp.squeeze().data.numpy().astype(dtype_in) | ||
before_input.tofile(log_folder + "/before_ifm_mem_fmt_1x1.txt", sep=",", format="%d") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
before_input.tofile(log_folder + "/before_ifm_mem_fmt_1x1.txt", sep=",", format="%d") | |
before_input.tofile( | |
log_folder + "/before_ifm_mem_fmt_1x1.txt", sep=",", format="%d" | |
) |
stop = time.time_ns() | ||
|
||
if enable_trace: | ||
aie_output, trace = extract_trace(aie_output, shape_out, dtype_out, trace_size) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
aie_output, trace = extract_trace(aie_output, shape_out, dtype_out, trace_size) | |
aie_output, trace = extract_trace( | |
aie_output, shape_out, dtype_out, trace_size | |
) |
temp_out = aie_output.reshape(32, 32, 32, 8) | ||
temp_out = ds.reorder_mat(temp_out, "CDYX", "YCXD") | ||
ofm_mem_fmt = temp_out.reshape(256, 32, 32) | ||
ofm_mem_fmt.tofile(log_folder + "/after_ofm_mem_fmt_final.txt", sep=",", format="%d") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
ofm_mem_fmt.tofile(log_folder + "/after_ofm_mem_fmt_final.txt", sep=",", format="%d") | |
ofm_mem_fmt.tofile( | |
log_folder + "/after_ofm_mem_fmt_final.txt", sep=",", format="%d" | |
) |
|
||
print("\nPASS!\n") | ||
|
||
if __name__ == "__main__": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black] reported by reviewdog 🐶
if __name__ == "__main__": | |
if __name__ == "__main__": |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
No description provided.