helloadhavan/github_issues huggingface dataset:
Repository: ggml-org/llama.cpp
Pull request: kv-cache : fix out-of-bounds view during reserve graph

fix #13359

See the comments added in the code.

Changed files:
filename: src/llama-kv-cache.cpp
patch: @@ -441,6 +441,13 @@ void llama_kv_cache_unified::defrag_sched(float thold) {
 
 void llama_kv_cache_unified::set_full() {
     n = size;
+
+    // when simulating a full KV cache, the specific value of the "head" pointer is not important because it does not
+    //   affect the shapes of the tensors in the compute graph - it only affects the offsets of the K/V views.
+    //   we should only guarantee that the head position won't cause out-of-bounds view of the K, V tensors, so
+    //   setting it to 0 is the simplest way to achieve that
+    // ref: https://github.com/ggml-org/llama.cpp/issues/13359
+    head = 0;
 }
 
 llama_sbatch llama_kv_cache_unified::sbatch_init(
@@ -1712,6 +1719,7 @@ void llama_kv_cache_recurrent::defrag_sched(float thold) {
 
 void llama_kv_cache_recurrent::set_full() {
     n = size;
+    head = 0;
 }
 
 llama_sbatch llama_kv_cache_recurrent::sbatch_init(

filename: src/llama-kv-cache.h
patch: @@ -171,11 +171,8 @@ class llama_kv_cache_unified : public llama_kv_cache {
     void state_write(llama_io_write_i & io, llama_seq_id seq_id = -1) const override;
     void state_read (llama_io_read_i  & io, llama_seq_id seq_id = -1) override;
 
-    // Note: The value of head isn't only used to optimize searching
-    // for a free KV slot. llama_decode_impl also uses it, so it
-    // cannot be freely changed after a slot has been allocated.
-    uint32_t head = 0;
-    uint32_t size = 0;
+    uint32_t head = 0; // the location where the batch will be placed in the cache (see find_slot())
+    uint32_t size = 0; // total number of cells, shared across all sequences
     uint32_t used = 0; // used cells (i.e. at least one seq_id)
 
     // computed before each graph build
@@ -343,11 +340,8 @@ class llama_kv_cache_recurrent : public llama_kv_cache {
     void state_write(llama_io_write_i & io, llama_seq_id seq_id = -1) const override;
     void state_read (llama_io_read_i  & io, llama_seq_id seq_id = -1) override;
 
-    // Note: The value of head isn't only used to optimize searching
-    // for a free KV slot. llama_decode_impl also uses it, so it
-    // cannot be freely changed after a slot has been allocated.
-    uint32_t head = 0;
-    uint32_t size = 0;
+    uint32_t head = 0; // the location where the batch will be placed in the cache (see find_slot())
+    uint32_t size = 0; // total number of cells, shared across all sequences
     uint32_t used = 0; // used cells (i.e. at least one seq_id)
 
     // computed before each graph build
Repository: ggml-org/llama.cpp
Pull request: editorconfig : fix trailing whitespace from #13542


Changed files:
filename: src/llama-context.cpp
patch: @@ -1705,7 +1705,7 @@ size_t llama_context::state_write_data(llama_io_write_i & io) {
     }
 
     llama_kv_cache * kv_self = static_cast<llama_kv_cache *>(memory.get());
-    
+
     if (kv_self != nullptr) {
         LLAMA_LOG_DEBUG("%s: - writing KV self\n", __func__);
         kv_self->state_write(io);
Repository: facebook/react
Pull request: Remove rc suffix from versions


Changed files:
filename: ReactVersions.js
patch: @@ -18,26 +18,26 @@
 //
 //   0.0.0-experimental-241c4467e-20200129
 
-const ReactVersion = '18.0.0-rc.3';
+const ReactVersion = '18.0.0';
 
 // The label used by the @next channel. Represents the upcoming release's
 // stability. Could be "alpha", "beta", "rc", etc.
 const nextChannelLabel = 'next';
 
 const stablePackages = {
   'create-subscription': ReactVersion,
-  'eslint-plugin-react-hooks': '4.2.1-rc.3',
-  'jest-react': '0.12.1-rc.3',
+  'eslint-plugin-react-hooks': '4.4.0',
+  'jest-react': '0.12.1',
   react: ReactVersion,
   'react-art': ReactVersion,
   'react-dom': ReactVersion,
   'react-is': ReactVersion,
-  'react-reconciler': '0.27.0-rc.3',
-  'react-refresh': '0.11.0-rc.3',
+  'react-reconciler': '0.27.0',
+  'react-refresh': '0.11.0',
   'react-test-renderer': ReactVersion,
-  'use-subscription': '1.6.0-rc.3',
-  'use-sync-external-store': '1.0.0-rc.3',
-  scheduler: '0.21.0-rc.3',
+  'use-subscription': '1.6.0',
+  'use-sync-external-store': '1.0.0',
+  scheduler: '0.21.0',
 };
 
 // These packages do not exist in the @next or @latest channel, only
Repository: vercel/next.js
Pull request: Update authentication.mdx

Fix a bug that may confuse beginners.

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the PR.
- Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to understand the PR)
- When linking to a Slack thread, you might want to share details of the conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->


Changed files:
filename: docs/01-app/02-guides/authentication.mdx
patch: @@ -801,7 +801,7 @@ import { cookies } from 'next/headers'
 import { deleteSession } from '@/app/lib/session'
 
 export async function logout() {
-  deleteSession()
+  await deleteSession()
   redirect('/login')
 }
 ```
@@ -811,7 +811,7 @@ import { cookies } from 'next/headers'
 import { deleteSession } from '@/app/lib/session'
 
 export async function logout() {
-  deleteSession()
+  await deleteSession()
   redirect('/login')
 }
 ```
Repository: facebook/react
Pull request: Fix usage of console.error to prevent transform

## Summary

We were suppressing the `react-internals/warning-args` lint rule for the call to `console.error` in `defaultOnRecoverableError` which was leading to a bug on dev builds. See below.

As far as I could tell, the lint rule exists because on dev builds, we replace all calls to `console.error` with [this error
function](https://github.com/facebook/react/blob/main/packages/shared/consoleWithStackDev.js#L31-L37) which expects a format string + args and nothing else. We were trying to pass in an `Error` object directly. After this commit's change, we will still be passing in an `Error` object but the `console.error` call won't be transformed.

## How did you test this change?

Tested via

```
$ yarn flow dom
$ yarn linc
```

Changed files:
filename: packages/react-dom/src/client/ReactDOMRoot.js
patch: @@ -81,8 +81,8 @@ const defaultOnRecoverableError =
       reportError
     : (error: mixed) => {
         // In older browsers and test environments, fallback to console.error.
-        // eslint-disable-next-line react-internal/no-production-logging, react-internal/warning-args
-        console.error(error);
+        // eslint-disable-next-line react-internal/no-production-logging
+        console['error'](error);
       };
 
 function ReactDOMRoot(internalRoot: FiberRoot) {
Repository: vercel/next.js
Pull request: Upgrade loader-utils v2 to latest patch

### What

Upgrade the `loader-utils@2` to latest patch for dependency alert

https://github.com/vercel/next.js/security/dependabot/758

Changed files:
filename: packages/next/package.json
patch: @@ -274,7 +274,7 @@
     "json5": "2.2.3",
     "jsonwebtoken": "9.0.0",
     "loader-runner": "4.3.0",
-    "loader-utils2": "npm:loader-utils@2.0.0",
+    "loader-utils2": "npm:loader-utils@2.0.4",
     "loader-utils3": "npm:loader-utils@3.1.3",
     "lodash.curry": "4.1.1",
     "mini-css-extract-plugin": "2.4.4",

filename: pnpm-lock.yaml
patch: @@ -1343,8 +1343,8 @@ importers:
         specifier: 4.3.0
         version: 4.3.0
       loader-utils2:
-        specifier: npm:loader-utils@2.0.0
-        version: loader-utils@2.0.0
+        specifier: npm:loader-utils@2.0.4
+        version: loader-utils@2.0.4
       loader-utils3:
         specifier: npm:loader-utils@3.1.3
         version: loader-utils@3.1.3
@@ -11082,8 +11082,8 @@ packages:
     resolution: {integrity: sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==}
     engines: {node: '>=4.0.0'}
 
-  loader-utils@2.0.0:
-    resolution: {integrity: sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==}
+  loader-utils@2.0.4:
+    resolution: {integrity: sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==}
     engines: {node: '>=8.9.0'}
 
   loader-utils@3.1.3:
@@ -28265,7 +28265,7 @@ snapshots:
       emojis-list: 3.0.0
       json5: 1.0.2
 
-  loader-utils@2.0.0:
+  loader-utils@2.0.4:
     dependencies:
       big.js: 5.2.2
       emojis-list: 3.0.0
Repository: denoland/deno
Pull request: fix(ext/node): http2session ready state

Fixes #25142 

Changed files:
filename: ext/node/polyfills/http2.ts
patch: @@ -513,6 +513,7 @@ export class ClientHttp2Session extends Http2Session {
           this.emit("error", e);
         }
       })();
+      this[kState].flags |= SESSION_FLAGS_READY;
       this.emit("connect", this, {});
     })();
   }
Repository: nodejs/node
Pull request: deps: update ngtcp2 to 1.9.1

This is an automated update of ngtcp2 to 1.9.1.

Changed files:
filename: deps/ngtcp2/ngtcp2/lib/includes/ngtcp2/version.h
patch: @@ -36,7 +36,7 @@
  *
  * Version number of the ngtcp2 library release.
  */
-#define NGTCP2_VERSION "1.9.0"
+#define NGTCP2_VERSION "1.9.1"
 
 /**
  * @macro
@@ -46,6 +46,6 @@
  * number, 8 bits for minor and 8 bits for patch. Version 1.2.3
  * becomes 0x010203.
  */
-#define NGTCP2_VERSION_NUM 0x010900
+#define NGTCP2_VERSION_NUM 0x010901
 
 #endif /* !defined(NGTCP2_VERSION_H) */

filename: deps/ngtcp2/ngtcp2/lib/ngtcp2_conn.c
patch: @@ -5322,35 +5322,28 @@ int ngtcp2_conn_detect_lost_pkt(ngtcp2_conn *conn, ngtcp2_pktns *pktns,
  * conn_recv_ack processes received ACK frame |fr|.  |pkt_ts| is the
  * timestamp when packet is received.  |ts| should be the current
  * time.  Usually they are the same, but for buffered packets,
- * |pkt_ts| would be earlier than |ts|.
+ * |pkt_ts| would be earlier than |ts|.  This function needs to be
+ * called after |fr| is validated by ngtcp2_pkt_validate_ack.
  *
  * This function returns 0 if it succeeds, or one of the following
  * negative error codes:
  *
  * NGTCP2_ERR_NOMEM
  *     Out of memory
- * NGTCP2_ERR_ACK_FRAME
- *     ACK frame is malformed.
  * NGTCP2_ERR_PROTO
  *     |fr| acknowledges a packet this endpoint has not sent.
  * NGTCP2_ERR_CALLBACK_FAILURE
  *     User callback failed.
  */
 static int conn_recv_ack(ngtcp2_conn *conn, ngtcp2_pktns *pktns, ngtcp2_ack *fr,
                          ngtcp2_tstamp pkt_ts, ngtcp2_tstamp ts) {
-  int rv;
   ngtcp2_ssize num_acked;
   ngtcp2_conn_stat *cstat = &conn->cstat;
 
   if (pktns->tx.last_pkt_num < fr->largest_ack) {
     return NGTCP2_ERR_PROTO;
   }
 
-  rv = ngtcp2_pkt_validate_ack(fr, conn->local.settings.initial_pkt_num);
-  if (rv != 0) {
-    return rv;
-  }
-
   ngtcp2_acktr_recv_ack(&pktns->acktr, fr);
 
   num_acked =
@@ -6561,6 +6554,13 @@ conn_recv_handshake_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
     case NGTCP2_FRAME_ACK_ECN:
       fr->ack.ack_delay = 0;
       fr->ack.ack_delay_unscaled = 0;
+
+      rv =
+        ngtcp2_pkt_validate_ack(&fr->ack, conn->local.settings.initial_pkt_num);
+      if (rv != 0) {
+        return rv;
+      }
+
       break;
     }
 
@@ -8715,6 +8715,13 @@ conn_recv_delayed_handshake_pkt(ngtcp2_conn *conn, const ngtcp2_pkt_info *pi,
     case NGTCP2_FRAME_ACK_ECN:
       fr->ack.ack_delay = 0;
       fr->ack.ack_delay_unscaled = 0;
+
+      rv =
+        ngtcp2_pkt_validate_ack(&fr->ack, conn->local.settings.initial_pkt_num);
+      if (rv != 0) {
+        return rv;
+      }
+
       break;
     }
 
@@ -9200,6 +9207,13 @@ static ngtcp2_ssize conn_recv_pkt(ngtcp2_conn *conn, const ngtcp2_path *path,
       assert(conn->remote.transport_params);
       assign_recved_ack_delay_unscaled(
         &fr->ack, conn->remote.transport_params->ack_delay_exponent);
+
+      rv =
+        ngtcp2_pkt_validate_ack(&fr->ack, conn->local.settings.initial_pkt_num);
+      if (rv != 0) {
+        return rv;
+      }
+
       break;
     }
Repository: ggml-org/llama.cpp
Pull request: fix: crash when calling `llama_state_get_size` on a context without a KV cache

Fixes #13463


Changed files:
filename: src/llama-context.cpp
patch: @@ -1704,10 +1704,12 @@ size_t llama_context::state_write_data(llama_io_write_i & io) {
         }
     }
 
-    LLAMA_LOG_DEBUG("%s: - writing KV self\n", __func__);
     llama_kv_cache * kv_self = static_cast<llama_kv_cache *>(memory.get());
-
-    kv_self->state_write(io);
+    
+    if (kv_self != nullptr) {
+        LLAMA_LOG_DEBUG("%s: - writing KV self\n", __func__);
+        kv_self->state_write(io);
+    }
 
     return io.n_bytes();
 }
Repository: nodejs/node
Pull request: tools: fix `require-common-first` lint rule from subfolder


Changed files:
filename: test/addons/esm/test-esm.mjs
patch: @@ -4,7 +4,6 @@
  * the ESM loader or the CJS loader.
  */
 
-// eslint-disable-next-line node-core/require-common-first
 import { buildType } from '../../common/index.mjs';
 import assert from 'node:assert';
 import { createRequire } from 'node:module';

filename: test/parallel/test-eslint-require-common-first.js
patch: @@ -20,6 +20,12 @@ new RuleTester({
       code: 'require("common")\n' +
             'require("assert")'
     },
+    {
+      code: 'import "../../../../common/index.mjs";',
+      languageOptions: {
+        sourceType: 'module',
+      },
+    },
   ],
   invalid: [
     {

filename: tools/eslint-rules/require-common-first.js
patch: @@ -22,7 +22,7 @@ module.exports = {
      * @returns {string} module name
      */
     function getModuleName(str) {
-      if (str === '../common/index.mjs') {
+      if (str.startsWith('../') && str.endsWith('/common/index.mjs')) {
         return 'common';
       }
Repository: denoland/deno
Pull request: fix: trim space around DENO_AUTH_TOKENS

Fixes #25043

Changed files:
filename: cli/auth_tokens.rs
patch: @@ -123,19 +123,19 @@ impl AuthTokens {
   pub fn new(maybe_tokens_str: Option<String>) -> Self {
     let mut tokens = Vec::new();
     if let Some(tokens_str) = maybe_tokens_str {
-      for token_str in tokens_str.split(';') {
+      for token_str in tokens_str.trim().split(';') {
         if token_str.contains('@') {
-          let pair: Vec<&str> = token_str.rsplitn(2, '@').collect();
-          let token = pair[1];
-          let host = AuthDomain::from(pair[0]);
+          let mut iter = token_str.rsplitn(2, '@');
+          let host = AuthDomain::from(iter.next().unwrap());
+          let token = iter.next().unwrap();
           if token.contains(':') {
-            let pair: Vec<&str> = token.rsplitn(2, ':').collect();
-            let username = pair[1].to_string();
-            let password = pair[0].to_string();
+            let mut iter = token.rsplitn(2, ':');
+            let password = iter.next().unwrap().to_owned();
+            let username = iter.next().unwrap().to_owned();
             tokens.push(AuthToken {
               host,
               token: AuthTokenData::Basic { username, password },
-            })
+            });
           } else {
             tokens.push(AuthToken {
               host,
@@ -211,6 +211,40 @@ mod tests {
     );
   }
 
+  #[test]
+  fn test_auth_tokens_space() {
+    let auth_tokens = AuthTokens::new(Some(
+      " abc123@deno.land;def456@example.com\t".to_string(),
+    ));
+    let fixture = resolve_url("https://deno.land/x/mod.ts").unwrap();
+    assert_eq!(
+      auth_tokens.get(&fixture).unwrap().to_string(),
+      "Bearer abc123".to_string()
+    );
+    let fixture = resolve_url("http://example.com/a/file.ts").unwrap();
+    assert_eq!(
+      auth_tokens.get(&fixture).unwrap().to_string(),
+      "Bearer def456".to_string()
+    );
+  }
+
+  #[test]
+  fn test_auth_tokens_newline() {
+    let auth_tokens = AuthTokens::new(Some(
+      "\nabc123@deno.land;def456@example.com\n".to_string(),
+    ));
+    let fixture = resolve_url("https://deno.land/x/mod.ts").unwrap();
+    assert_eq!(
+      auth_tokens.get(&fixture).unwrap().to_string(),
+      "Bearer abc123".to_string()
+    );
+    let fixture = resolve_url("http://example.com/a/file.ts").unwrap();
+    assert_eq!(
+      auth_tokens.get(&fixture).unwrap().to_string(),
+      "Bearer def456".to_string()
+    );
+  }
+
   #[test]
   fn test_auth_tokens_port() {
     let auth_tokens =
Repository: facebook/react
Pull request: [fizz] Fix validateIterable call

<!--
  Thanks for submitting a pull request!
  We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The three fields below are mandatory.

  Before submitting a pull request, please make sure the following is done:

  1. Fork [the repository](https://github.com/facebook/react) and create your branch from `main`.
  2. Run `yarn` in the repository root.
  3. If you've fixed a bug or added code that should be tested, add tests!
  4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch TestName` is helpful in development.
  5. Run `yarn test --prod` to test in the production environment. It supports the same options as `yarn test`.
  6. If you need a debugger, run `yarn debug-test --watch TestName`, open `chrome://inspect`, and press "Inspect".
  7. Format your code with [prettier](https://github.com/prettier/prettier) (`yarn prettier`).
  8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

  Learn more about contributing: https://reactjs.org/docs/how-to-contribute.html
-->

## Summary

I think this was a typo?
<!--
 Explain the **motivation** for making this change. What existing problem does the pull request solve?
-->

## How did you test this change?

jest

<!--
  Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes the user interface.
  How exactly did you verify that your PR solves the issue you wanted to solve?
  If you leave this empty, your PR will very likely be closed.
-->


Changed files:
filename: packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
patch: @@ -2508,4 +2508,27 @@ describe('ReactDOMFizzServer', () => {
       <span>default</span>,
     ]);
   });
+
+  // @gate experimental
+  it('Supports iterable', async () => {
+    const Immutable = require('immutable');
+
+    const mappedJSX = Immutable.fromJS([
+      {name: 'a', value: 'a'},
+      {name: 'b', value: 'b'},
+    ]).map(item => <li key={item.get('value')}>{item.get('name')}</li>);
+
+    await act(async () => {
+      const {pipe} = ReactDOMFizzServer.renderToPipeableStream(
+        <ul>{mappedJSX}</ul>,
+      );
+      pipe(writable);
+    });
+    expect(getVisibleChildren(container)).toEqual(
+      <ul>
+        <li>a</li>
+        <li>b</li>
+      </ul>,
+    );
+  });
 });

filename: packages/react-server/src/ReactFizzServer.js
patch: @@ -1181,7 +1181,7 @@ function renderNodeDestructive(
     const iteratorFn = getIteratorFn(node);
     if (iteratorFn) {
       if (__DEV__) {
-        validateIterable(node, iteratorFn());
+        validateIterable(node, iteratorFn);
       }
       const iterator = iteratorFn.call(node);
       if (iterator) {
Repository: electron/electron
Pull request: fix: resizing border on Linux WCO caption buttons

Backport of #43724

See that PR for details.


Notes: Fixes an issue when dragging to resize when using Window Controls Overlay on Linux.


Changed files:
filename: shell/browser/ui/views/opaque_frame_view.cc
patch: @@ -135,6 +135,11 @@ gfx::Rect OpaqueFrameView::GetWindowBoundsForClientBounds(
 
 int OpaqueFrameView::NonClientHitTest(const gfx::Point& point) {
   if (window()->IsWindowControlsOverlayEnabled()) {
+    // Ensure support for resizing frameless window with border drag.
+    int frame_component = ResizingBorderHitTest(point);
+    if (frame_component != HTNOWHERE)
+      return frame_component;
+
     if (HitTestCaptionButton(close_button_, point))
       return HTCLOSE;
     if (HitTestCaptionButton(restore_button_, point))
Repository: ggml-org/llama.cpp
Pull request: llama : fix quantize with dl backends

Fixes #13518
Fixes #13380 

Changed files:
filename: src/llama-model-loader.cpp
patch: @@ -822,13 +822,18 @@ void llama_model_loader::init_mappings(bool prefetch, llama_mlocks * mlock_mmaps
         mappings.reserve(files.size());
         mmaps_used.reserve(files.size());
         for (const auto & file : files) {
-            auto * reg = ggml_backend_dev_backend_reg(ggml_backend_dev_by_type(GGML_BACKEND_DEVICE_TYPE_CPU));
-            if (!reg) {
-                throw std::runtime_error(format("%s: no CPU backend found", __func__));
+            bool is_numa = false;
+
+            auto * dev = ggml_backend_dev_by_type(GGML_BACKEND_DEVICE_TYPE_CPU);
+            if (dev) {
+                auto * reg = ggml_backend_dev_backend_reg(dev);
+                auto * is_numa_fn = (decltype(ggml_is_numa) *) ggml_backend_reg_get_proc_address(reg, "ggml_backend_cpu_is_numa");
+                if (is_numa_fn) {
+                    is_numa = is_numa_fn();
+                }
             }
 
-            auto * is_numa_fn = (decltype(ggml_is_numa) *) ggml_backend_reg_get_proc_address(reg, "ggml_backend_cpu_is_numa");
-            std::unique_ptr<llama_mmap> mapping = std::make_unique<llama_mmap>(file.get(), prefetch ? -1 : 0, is_numa_fn());
+            std::unique_ptr<llama_mmap> mapping = std::make_unique<llama_mmap>(file.get(), prefetch ? -1 : 0, is_numa);
             mmaps_used.emplace_back(mapping->size(), 0);
             if (mlock_mmaps) {
                 std::unique_ptr<llama_mlock> mlock_mmap(new llama_mlock());