Skip to content
  1. Jan 18, 2019
  2. Jan 17, 2019
    • Bas Nieuwenhuizen's avatar
      nir: Account for atomics in copy propagation. · 8424cd8f
      Bas Nieuwenhuizen authored
      
      
      Otherwise writes get propagated across atomics if no barrier is
      used. Without barrier writes should still be visible in the same
      invocation, so an atomic has to be considered a write.
      
      CC: <mesa-stable@lists.freedesktop.org>
      Reviewed-by: default avatarCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
      Fixes: b3c61469 "nir: Copy propagation between blocks"
      Fixes: 62332d13 "nir: Add a local variable-based copy propagation pass"
      8424cd8f
    • Rafael Antognolli's avatar
      anv/tests: Adding test for the state_pool padding. · 927ba12b
      Rafael Antognolli authored
      
      
      Add a test that checks that we can use the extra space allocated for
      padding while allocating larger anv_states.
      
      Reviewed-by: default avatarJason Ekstrand <jason@jlekstrand.net>
      927ba12b
    • Rafael Antognolli's avatar
      anv/allocator: Add support for non-userptr. · 731c4adc
      Rafael Antognolli authored
      
      
      If softpin is supported, create new BOs for the required size and add the
      respective BO maps. The other main change of this commit is that
      anv_block_pool_map() now returns the map for the BO that the given
      offset is part of. So there's no block_pool->map access anymore (when
      softpin is used.
      
      v3:
       - set fd to -1 on softpin case (Jason)
      
      Reviewed-by: default avatarJason Ekstrand <jason@jlekstrand.net>
      731c4adc
    • Rafael Antognolli's avatar
      anv: Remove state flush. · 643248b6
      Rafael Antognolli authored
      
      
      We have all the state buffers snooped, so we don't need to clflush
      everything anymore.
      
      Reviewed-by: default avatarJason Ekstrand <jason@jlekstrand.net>
      643248b6
    • Rafael Antognolli's avatar
      anv/allocator: Enable snooping on block pool and anv_bo_pool BOs. · 5d61c74f
      Rafael Antognolli authored
      
      
      We are not going to use userptr for anv block pool BOs anymore. However,
      so far we have been relying on the fact that userptr BOs are snooped on
      non-llc platforms. Let's make sure that the block pool BOs are still
      snooped, and we can also remove the clflush'ing that we do on all state
      buffers.
      
      And since we plan to remove the flushes, set the anv_bo_pool BOs to
      cached (snooped on non-LLC platforms) too. For LLC platforms, they are
      all cached by default, so this becomes a no-op.
      
      v5:
       - Add snooping to anv_bo_pool BOs too (Jason).
       - Remove anv_gem_set_domain.
      
      Reviewed-by: default avatarJason Ekstrand <jason@jlekstrand.net>
      5d61c74f
    • Rafael Antognolli's avatar
      anv/allocator: Add padding information. · dfc9ab2c
      Rafael Antognolli authored
      
      
      It's possible that we still have some space left in the block pool, but
      we try to allocate a state larger than that state. This means such state
      would start somewhere within the range of the old block_pool, and end
      after that range, within the range of the new size.
      
      That's fine when we use userptr, since the memory in the block pool is
      CPU mapped continuously. However, by the end of this series, we will
      have the block_pool split into different BOs, with different CPU
      mapping ranges that are not necessarily continuous. So we must avoid
      such case of a given state being part of two different BOs in the block
      pool.
      
      This commit solves the issue by detecting that we are growing the
      block_pool even though we are not at the end of the range. If that
      happens, we don't use the space left at the end of the old size, and
      consider it as "padding" that can't be used in the allocation. We update
      the size requested from the block pool to take the padding into account,
      and return the offset after the padding, which happens to be at the
      start of the new address range.
      
      Additionally, we return the amount of padding we used, so the caller
      knows that this happens and can return that padding back into a list of
      free states, that can be reused later. This way we hopefully don't waste
      any space, but also avoid having a state split between two different
      BOs.
      
      v3:
       - Calculate offset + padding at anv_block_pool_alloc_new (Jason).
      v4:
       - Remove extra "leftover".
      
      Reviewed-by: default avatarJason Ekstrand <jason@jlekstrand.net>
      dfc9ab2c
    • Rafael Antognolli's avatar
      anv/allocator: Rework chunk return to the state pool. · 7ed0898a
      Rafael Antognolli authored
      
      
      This commit tries to rework the code that split and returns chunks back
      to the state pool, while still keeping the same logic.
      
      The original code would get a chunk larger than we need and split it
      into pool->block_size. Then it would return all but the first one, and
      would split that first one into alloc_size chunks. Then it would keep
      the first one (for the allocation), and return the others back to the
      pool.
      
      The new anv_state_pool_return_chunk() function will take a chunk (with
      the alloc_size part removed), and a small_size hint. It then splits that
      chunk into pool->block_size'd chunks, and if there's some space still
      left, split that into small_size chunks. small_size in this case is the
      same size as alloc_size.
      
      The idea is to keep the same logic, but make it in a way we can reuse it
      to return other chunks to the pool when we are growing the buffer.
      
      v2:
       - Include Jason's suggestions to the algorithm that returns chunks.
       - Update comments.
      
      v3:
       - Disallow returning 0 blocks (Jason).
       - fix min_size in the loop (Jason).
       - remove temporary variables (Jason)
      v4:
       - return_chunk() should never return blocks larger than
       pool->block_size.
      
      Reviewed-by: default avatarJason Ekstrand <jason@jlekstrand.net>
      7ed0898a
    • Rafael Antognolli's avatar
      anv: Remove some asserts. · 6a1f4c96
      Rafael Antognolli authored
      
      
      They won't be true anymore once we add support for multiple BOs with
      non-userptr.
      
      Reviewed-by: default avatarJason Ekstrand <jason@jlekstrand.net>
      6a1f4c96
    • Rafael Antognolli's avatar
      anv: Validate the list of BOs from the block pool. · f39dad7e
      Rafael Antognolli authored
      
      
      We now have multiple BOs in the block pool, but sometimes we still
      reference only the first one in some instructions, and use relative
      offsets in others. So we must be sure to add all the BOs from the block
      pool to the validation list when submitting commands.
      
      v2:
         - Don't add block pool BOs to the dependency list right before
         execbuf (Jason)
         - Call anv_execbuf_add_bo() to each BO in the block pools (Jason)
         - Use anv_execbuf_add_bo_set() to add surface state dependencies to
         execbuf.
      
      v3:
         - Add comment to the non-softpin case (Jason).
      
      Reviewed-by: default avatarJason Ekstrand <jason@jlekstrand.net>
      f39dad7e
    • Rafael Antognolli's avatar
      anv: Split code to add BO dependencies to execbuf. · 11a5d462
      Rafael Antognolli authored
      
      
      This part of the anv_execbuf_add_bo() code is totally independent of the
      BO being added. Let's split it out, so we can reuse it later.
      
      v3: rename to anv_execbuf_add_bo_set (Jason).
      
      Reviewed-by: default avatarJason Ekstrand <jason@jlekstrand.net>
      11a5d462