code: def test_target_blocks_search_space():
      # Test that specific blocks of trinity matmul can be targeted.
      def filter_fn(block, target_names) -> bool:
          return block.name_hint in target_names
  
      def _get_sch(filter_fn):
          mod = TrinityMatmul
          context = TuneContext(
              mod=mod,
              target=Target("llvm"),
              task_name="Custom Search Space Task",
              space_generator=PostOrderApply(
                  f_block_filter=filter_fn,
                  sch_rules=[TrinityDoubleRule()],
                  postprocs=[],
                  mutator_probs={},
              ),
          )
          post_order_apply = context.space_generator
          schs = post_order_apply.generate_design_space(mod)
          return schs
  
      # Start by checking that by default each block has a space generated.
      schs = _get_sch(None)
      assert len(schs) == 8
  
      # Next check that we can target a specific block and only get its' revelant schedules.
      schs = _get_sch(lambda block: filter_fn(block, ["B"]))
      assert len(schs) == 2
  
      ## Check that extracting two blocks works.
      schs = _get_sch(lambda block: filter_fn(block, ["A", "C"]))
      assert len(schs) == 4
  
      ## Finally check that all blocks can be extracted by name.
      schs = _get_sch(lambda block: filter_fn(block, ["A", "B", "C"]))
      assert len(schs) == 8
  
imports: import math
  import sys
  from typing import List
  import pytest
  import tvm
  import tvm.testing
  from tvm import te
  from tvm.ir.module import IRModule
  from tvm._ffi import register_func
  from tvm.error import TVMError
  from tvm.meta_schedule import TuneContext
  from tvm.meta_schedule.schedule_rule import PyScheduleRule
  from tvm.meta_schedule.space_generator import PostOrderApply
  from tvm.meta_schedule.utils import derived_object
  from tvm.script import tir
  from tvm.target import Target
  from tvm.tir.schedule import BlockRV, Schedule
label_desc: Use image node_id 9 for calling a global function with example usage: test_target_blocks_search_space() and returns: unknown, schs