-
Notifications
You must be signed in to change notification settings - Fork 2k
Modularize the WASM kernels into separate build targets. #2173
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
Conversation
dsmilkov
left a comment
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.
Reviewed 3 of 10 files at r1.
Reviewable status: 0 of 1 approvals obtained (waiting on @dsmilkov and @nsthorat)
tfjs-backend-wasm/src/cc/backend.cc, line 30 at r1 (raw file):
std::map<int, TensorInfo> data; TensorInfo get_tensor_info(int tensor_id) { return data.at(tensor_id); }
make get_tensor_info() which is a public api live under tfjs/backend namespace , not just tfjs
This way other files that include backend.h can call backend::get_tensor_info which tells you from which file those imports came.
https://google.github.io/styleguide/cppguide.html#Namespaces
tfjs-backend-wasm/src/cc/kernels.h, line 15 at r1 (raw file):
* ===========================================================================*/ #ifndef TFJS_WASM_KERNELS_H_
make sure each new file has these guards to defend against duplicate code.
https://google.github.io/styleguide/cppguide.html#The__define_Guard
dsmilkov
left a comment
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.
Reviewable status: 0 of 1 approvals obtained (waiting on @nsthorat)
tfjs-backend-wasm/src/cc/backend.cc, line 28 at r1 (raw file):
// Maps a unique tensor id to info about that tensor. The map owns all of its // entries. std::map<int, TensorInfo> data;
move data to unnamed namespace which makes it truly private. see https://google.github.io/styleguide/cppguide.html#Unnamed_Namespaces_and_Static_Variables
nsthorat
left a comment
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.
Reviewable status: 0 of 1 approvals obtained (waiting on @dsmilkov)
tfjs-backend-wasm/src/cc/backend.cc, line 28 at r1 (raw file):
Previously, dsmilkov (Daniel Smilkov) wrote…
move data to unnamed namespace which makes it truly private. see https://google.github.io/styleguide/cppguide.html#Unnamed_Namespaces_and_Static_Variables
Done
tfjs-backend-wasm/src/cc/backend.cc, line 30 at r1 (raw file):
Previously, dsmilkov (Daniel Smilkov) wrote…
make get_tensor_info() which is a public api live under tfjs/backend namespace , not just tfjs
This way other files that include backend.h can call backend::get_tensor_info which tells you from which file those imports came.
https://google.github.io/styleguide/cppguide.html#Namespaces
Done
tfjs-backend-wasm/src/cc/kernels.h, line 15 at r1 (raw file):
Previously, dsmilkov (Daniel Smilkov) wrote…
make sure each new file has these guards to defend against duplicate code.
https://google.github.io/styleguide/cppguide.html#The__define_Guard
all new .h files have this already :)
dsmilkov
left a comment
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.
Reviewed 4 of 10 files at r1, 4 of 4 files at r2.
Reviewable status:complete! 1 of 1 approvals obtained
This change is