[all-commits] [llvm/llvm-project] ff0f1d: [mlir:python] Small optimization to get_op_result_...

Peter Hawkins via All-commits all-commits at lists.llvm.org
Wed Jan 22 05:41:55 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ff0f1dd341cb2fdc1281a14413b3aa93bf9a20c7
      https://github.com/llvm/llvm-project/commit/ff0f1dd341cb2fdc1281a14413b3aa93bf9a20c7
  Author: Peter Hawkins <phawkins at google.com>
  Date:   2025-01-22 (Wed, 22 Jan 2025)

  Changed paths:
    M mlir/python/mlir/dialects/_ods_common.py

  Log Message:
  -----------
  [mlir:python] Small optimization to get_op_result_or_results. (#123866)

* We can call .results without figuring out whether we have an Operation
or an OpView, and that's likely the common case anyway.
* If we have one or more results, we can return them directly, with no
need for a call to get_op_result_or_value. We're guaranteed that
.results returns a PyOpResultList, so we have either an OpResult or
sequence of OpResults, just as the API expects.

This saves a few 100ms during IR construction in an LLM JAX benchmark.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list