code: def test_memory_planning(
      workspace_byte_alignment,
      constant_byte_alignment,
      main_workspace_size,
      main_constant_size,
      usmp_algo,
  ):
      """Checks calculated workspace against known values"""
      random.seed(0)
      mod, params = tvm.relay.testing.synthetic.get_workload()
      target = "c"
      runtime = Runtime("crt")
      executor = Executor(
          "aot",
          {
              "workspace-byte-alignment": workspace_byte_alignment,
              "constant-byte-alignment": constant_byte_alignment,
          },
      )
      with tvm.transform.PassContext(
          opt_level=3,
          config={
              "tir.disable_vectorize": True,
              "tir.disable_storage_rewrite": True,
              "tir.usmp.enable": True,
              "tir.usmp.algorithm": usmp_algo,
          },
      ):
          lib = tvm.relay.build(
              mod,
              target,
              executor=executor,
              runtime=runtime,
              params=params,
          )
      # The workspace_size dictionary will have an entry for both the 'primitive' and 'host'
      # targets, though both are identical.
      assert (
          sum(
              lib.function_metadata[
                  "__tvm_main__"
              ].workspace_sizes.values()
          )
          == main_workspace_size
      )
      assert (
          sum(
              lib.function_metadata[
                  "__tvm_main__"
              ].constant_sizes.values()
          )
          == main_constant_size
      )
  
imports: from collections import OrderedDict
  import re
  import random
  import numpy
  import pytest
  import tvm
  from tvm import relay
  from tvm.relay import testing
  from tvm.relay import transform
  from tvm.relay.op.annotation import compiler_begin, compiler_end
  from tvm.relay.backend import Executor, Runtime
  from tvm import WorkspaceMemoryPools, ConstantMemoryPools, WorkspacePoolInfo, ConstantPoolInfo, PoolInfoProperties
  from tvm.micro import model_library_format
  from tvm.micro.testing.aot_test_utils import parametrize_aot_options
  from tvm.testing.aot import AOTTestModel, AOTTestRunner, generate_ref_data, compile_and_run, compile_models, run_and_check, create_relay_module_and_inputs_from_tflite_file
  from tvm.testing.usmp import is_tvm_backendallocworkspace_calls
label_desc: Use image node_id 3 for calling a global function with example usage: test_memory_planning(workspace_byte_alignment, constant_byte_alignment, main_workspace_size, main_constant_size, usmp_algo) without return types