Skip to content

Conversation

lisa0314
Copy link
Collaborator

@lisa0314 lisa0314 commented Jun 23, 2025

@huningxin PTAL.
Fix #237

@lisa0314 lisa0314 requested a review from huningxin June 23, 2025 08:19
graph_fusion_info.fusible_operations_set.insert(operation.get());
graph_fusion_info.matmul_input_b_to_fusible_dequantize_map
[transpose->get_transpose()->output_operand_id] = operation.get();

Copy link
Collaborator

Choose a reason for hiding this comment

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

Worth adding a comment explaining why it needs to change the data type.

dequantize_linear->label);
auto new_input_constant = std::make_unique<WebNNConstantOperand>(
std::move(new_input_desc), input_constant->TakeData());
constant_operands[dequantize_linear->input_operand_id] =
Copy link
Collaborator

Choose a reason for hiding this comment

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

You may want to check this constant is only used by dequantizeLinear before replacing it.

uint32_t blob_bytes = input_shape[2] / 2;
auto input_constant = std::move(
constant_operands.at(dequantize_linear->input_operand_id));
std::vector<uint32_t> new_input_buffer_shape = {input_feature_size,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Move this line right after declaring blob_bytes

uint32_t input_feature_size = input_shape[0];
uint32_t quant_num = input_shape[1];
uint32_t blob_bytes = input_shape[2] / 2;
auto input_constant = std::move(
Copy link
Collaborator

Choose a reason for hiding this comment

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

std::move is unnecessary? I guess std::move a reference would result in a copying.

constant_operands[dequantize_linear->input_operand_id] =
std::move(new_input_constant);

auto zero_point_constant = std::move(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here, std::move seems to be unnecessary.


auto zero_point_constant = std::move(
constant_operands.at(dequantize_linear->zero_point_operand_id));
std::vector<uint32_t> new_zero_point_buffer_shape = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
std::vector<uint32_t> new_zero_point_buffer_shape = {
std::vector<uint32_t> new_zero_point_shape = {

@huningxin
Copy link
Collaborator

/cc @wangw-1991

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MatMulNBits] Access the constants which has been moved before
2 participants