jcf94 commented on a change in pull request #7313:
URL: https://github.com/apache/tvm/pull/7313#discussion_r566526531
##########
File path: python/tvm/auto_scheduler/measure.py
##########
@@ -719,6 +722,87 @@ def local_builder_build(inputs, timeout, n_parallel,
build_func="default", verbo
return results
+def _process_sparse_input(args):
+ sparse_prefix = sparse_data = sparse_indices = sparse_indptr = None
+
+ def _process_inputs(input_tensors, M, N, prefix_init):
+ nonlocal sparse_prefix
+ nonlocal sparse_data
+ nonlocal sparse_indices
+ nonlocal sparse_indptr
+
+ assert len(input_tensors) == 4
+ unsure_tensors = list(input_tensors)
+ # Get the Dense data
+ dense_data = None
+ for tensor in unsure_tensors:
+ if len(tensor.shape) == 2:
+ assert dense_data is None
+ dense_data = tensor
+ assert M == dense_data.shape[0]
+ K = dense_data.shape[1]
+ unsure_tensors.remove(dense_data)
+
+ # Get the Sparse data
+ sparse_data = None
+ for tensor in unsure_tensors:
+ if len(tensor.shape) == 3:
+ assert sparse_data is None
+ sparse_data = tensor
+ block_size, BS_R, BS_C = sparse_data.shape
+ unsure_tensors.remove(sparse_data)
+
+ # Get the Sparse indptr & indices
+ sparse_indices = None
+ for tensor in unsure_tensors:
+ assert len(tensor.shape) == 1
+ if tensor.shape[0] == block_size:
+ assert sparse_indices is None
+ sparse_indices = tensor
+ unsure_tensors.remove(sparse_indices)
+ assert len(unsure_tensors) == 1
+ sparse_indptr = unsure_tensors[0]
+
+ # Generate the sparse_prefix
+ density = 1.0
+ for i in sparse_data.shape:
+ density *= i
+ density /= (K * N)
+ density = density.value
+ sparse_prefix = "%s_%d_%d_%d_%d_%d_%.2f_" % (
Review comment:
Though in my test a schedule seems to have similar performance with
different random sparse data, I think that may still be a potential problem.
Unfortunately, I have not figured out any better solution.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]